aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_cache.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-02-24 12:58:04 +0100
committerMichael Muré <batolettre@gmail.com>2019-03-01 22:48:50 +0100
commite100ee9f10dd7f600b58bf3d24b36f9b286210d6 (patch)
tree0df0fb14642aeda9b21564112b5a876fc64b8990 /cache/bug_cache.go
parentb59623a835f1f922d06ff7212b5bf7825624d134 (diff)
downloadgit-bug-e100ee9f10dd7f600b58bf3d24b36f9b286210d6.tar.gz
github: fix 3 edge-case failures
Diffstat (limited to 'cache/bug_cache.go')
-rw-r--r--cache/bug_cache.go68
1 files changed, 34 insertions, 34 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index 53a96275..5fc76658 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -57,8 +57,8 @@ func (e ErrMultipleMatchOp) Error() string {
return fmt.Sprintf("Multiple matching operation found:\n%s", strings.Join(casted, "\n"))
}
-// ResolveTargetWithMetadata will find an operation that has the matching metadata
-func (c *BugCache) ResolveTargetWithMetadata(key string, value string) (git.Hash, error) {
+// ResolveOperationWithMetadata will find an operation that has the matching metadata
+func (c *BugCache) ResolveOperationWithMetadata(key string, value string) (git.Hash, error) {
// preallocate but empty
matching := make([]git.Hash, 0, 5)
@@ -86,45 +86,45 @@ func (c *BugCache) ResolveTargetWithMetadata(key string, value string) (git.Hash
return matching[0], nil
}
-func (c *BugCache) AddComment(message string) error {
+func (c *BugCache) AddComment(message string) (*bug.AddCommentOperation, error) {
return c.AddCommentWithFiles(message, nil)
}
-func (c *BugCache) AddCommentWithFiles(message string, files []git.Hash) error {
+func (c *BugCache) AddCommentWithFiles(message string, files []git.Hash) (*bug.AddCommentOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
- return err
+ return nil, err
}
return c.AddCommentRaw(author, time.Now().Unix(), message, files, nil)
}
-func (c *BugCache) AddCommentRaw(author *IdentityCache, unixTime int64, message string, files []git.Hash, metadata map[string]string) error {
+func (c *BugCache) AddCommentRaw(author *IdentityCache, unixTime int64, message string, files []git.Hash, metadata map[string]string) (*bug.AddCommentOperation, error) {
op, err := bug.AddCommentWithFiles(c.bug, author.Identity, unixTime, message, files)
if err != nil {
- return err
+ return nil, err
}
for key, value := range metadata {
op.SetMetadata(key, value)
}
- return c.notifyUpdated()
+ return op, c.notifyUpdated()
}
-func (c *BugCache) ChangeLabels(added []string, removed []string) ([]bug.LabelChangeResult, error) {
+func (c *BugCache) ChangeLabels(added []string, removed []string) ([]bug.LabelChangeResult, *bug.LabelChangeOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
- return nil, err
+ return nil, nil, err
}
return c.ChangeLabelsRaw(author, time.Now().Unix(), added, removed, nil)
}
-func (c *BugCache) ChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, metadata map[string]string) ([]bug.LabelChangeResult, error) {
+func (c *BugCache) ChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, metadata map[string]string) ([]bug.LabelChangeResult, *bug.LabelChangeOperation, error) {
changes, op, err := bug.ChangeLabels(c.bug, author.Identity, unixTime, added, removed)
if err != nil {
- return changes, err
+ return changes, nil, err
}
for key, value := range metadata {
@@ -133,98 +133,98 @@ func (c *BugCache) ChangeLabelsRaw(author *IdentityCache, unixTime int64, added
err = c.notifyUpdated()
if err != nil {
- return nil, err
+ return nil, nil, err
}
- return changes, nil
+ return changes, op, nil
}
-func (c *BugCache) Open() error {
+func (c *BugCache) Open() (*bug.SetStatusOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
- return err
+ return nil, err
}
return c.OpenRaw(author, time.Now().Unix(), nil)
}
-func (c *BugCache) OpenRaw(author *IdentityCache, unixTime int64, metadata map[string]string) error {
+func (c *BugCache) OpenRaw(author *IdentityCache, unixTime int64, metadata map[string]string) (*bug.SetStatusOperation, error) {
op, err := bug.Open(c.bug, author.Identity, unixTime)
if err != nil {
- return err
+ return nil, err
}
for key, value := range metadata {
op.SetMetadata(key, value)
}
- return c.notifyUpdated()
+ return op, c.notifyUpdated()
}
-func (c *BugCache) Close() error {
+func (c *BugCache) Close() (*bug.SetStatusOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
- return err
+ return nil, err
}
return c.CloseRaw(author, time.Now().Unix(), nil)
}
-func (c *BugCache) CloseRaw(author *IdentityCache, unixTime int64, metadata map[string]string) error {
+func (c *BugCache) CloseRaw(author *IdentityCache, unixTime int64, metadata map[string]string) (*bug.SetStatusOperation, error) {
op, err := bug.Close(c.bug, author.Identity, unixTime)
if err != nil {
- return err
+ return nil, err
}
for key, value := range metadata {
op.SetMetadata(key, value)
}
- return c.notifyUpdated()
+ return op, c.notifyUpdated()
}
-func (c *BugCache) SetTitle(title string) error {
+func (c *BugCache) SetTitle(title string) (*bug.SetTitleOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
- return err
+ return nil, err
}
return c.SetTitleRaw(author, time.Now().Unix(), title, nil)
}
-func (c *BugCache) SetTitleRaw(author *IdentityCache, unixTime int64, title string, metadata map[string]string) error {
+func (c *BugCache) SetTitleRaw(author *IdentityCache, unixTime int64, title string, metadata map[string]string) (*bug.SetTitleOperation, error) {
op, err := bug.SetTitle(c.bug, author.Identity, unixTime, title)
if err != nil {
- return err
+ return nil, err
}
for key, value := range metadata {
op.SetMetadata(key, value)
}
- return c.notifyUpdated()
+ return op, c.notifyUpdated()
}
-func (c *BugCache) EditComment(target git.Hash, message string) error {
+func (c *BugCache) EditComment(target git.Hash, message string) (*bug.EditCommentOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {
- return err
+ return nil, err
}
return c.EditCommentRaw(author, time.Now().Unix(), target, message, nil)
}
-func (c *BugCache) EditCommentRaw(author *IdentityCache, unixTime int64, target git.Hash, message string, metadata map[string]string) error {
+func (c *BugCache) EditCommentRaw(author *IdentityCache, unixTime int64, target git.Hash, message string, metadata map[string]string) (*bug.EditCommentOperation, error) {
op, err := bug.EditComment(c.bug, author.Identity, unixTime, target, message)
if err != nil {
- return err
+ return nil, err
}
for key, value := range metadata {
op.SetMetadata(key, value)
}
- return c.notifyUpdated()
+ return op, c.notifyUpdated()
}
func (c *BugCache) Commit() error {