aboutsummaryrefslogtreecommitdiffstats
path: root/cache/bug_cache.go
diff options
context:
space:
mode:
authorMichael Muré <batolettre@gmail.com>2019-05-06 00:14:14 +0200
committerGitHub <noreply@github.com>2019-05-06 00:14:14 +0200
commit33c1c79a55f04689c45385c4ccf74da462532011 (patch)
tree7c4bfd33ae24f272df045583c4ace761c8dd4242 /cache/bug_cache.go
parentc0c8b11549930210688a06c64b3cc68d2159a0e8 (diff)
parent2e17f371758ad25a3674d65ef0e8e32a4660e6d4 (diff)
downloadgit-bug-33c1c79a55f04689c45385c4ccf74da462532011.tar.gz
Merge pull request #131 from A-Hilaly/github-import
github: support for partial import and refactor into iterator/importer
Diffstat (limited to 'cache/bug_cache.go')
-rw-r--r--cache/bug_cache.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/cache/bug_cache.go b/cache/bug_cache.go
index 5fc76658..aad6dab8 100644
--- a/cache/bug_cache.go
+++ b/cache/bug_cache.go
@@ -139,6 +139,33 @@ func (c *BugCache) ChangeLabelsRaw(author *IdentityCache, unixTime int64, added
return changes, op, nil
}
+func (c *BugCache) ForceChangeLabels(added []string, removed []string) (*bug.LabelChangeOperation, error) {
+ author, err := c.repoCache.GetUserIdentity()
+ if err != nil {
+ return nil, err
+ }
+
+ return c.ForceChangeLabelsRaw(author, time.Now().Unix(), added, removed, nil)
+}
+
+func (c *BugCache) ForceChangeLabelsRaw(author *IdentityCache, unixTime int64, added []string, removed []string, metadata map[string]string) (*bug.LabelChangeOperation, error) {
+ op, err := bug.ForceChangeLabels(c.bug, author.Identity, unixTime, added, removed)
+ if err != nil {
+ return nil, err
+ }
+
+ for key, value := range metadata {
+ op.SetMetadata(key, value)
+ }
+
+ err = c.notifyUpdated()
+ if err != nil {
+ return nil, err
+ }
+
+ return op, nil
+}
+
func (c *BugCache) Open() (*bug.SetStatusOperation, error) {
author, err := c.repoCache.GetUserIdentity()
if err != nil {