diff options
Diffstat (limited to 'bridge/jira')
-rw-r--r-- | bridge/jira/config.go | 20 | ||||
-rw-r--r-- | bridge/jira/export.go | 5 | ||||
-rw-r--r-- | bridge/jira/import.go | 11 | ||||
-rw-r--r-- | bridge/jira/jira.go | 4 |
4 files changed, 19 insertions, 21 deletions
diff --git a/bridge/jira/config.go b/bridge/jira/config.go index fc21111d..59076564 100644 --- a/bridge/jira/config.go +++ b/bridge/jira/config.go @@ -13,8 +13,8 @@ import ( "github.com/pkg/errors" "github.com/MichaelMure/git-bug/bridge/core" + "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/input" - "github.com/MichaelMure/git-bug/repository" ) const ( @@ -66,7 +66,7 @@ How would you like to store your JIRA login credentials? // Configure sets up the bridge configuration func (g *Jira) Configure( - repo repository.RepoCommon, params core.BridgeParams) ( + repo *cache.RepoCache, params core.BridgeParams) ( core.Configuration, error) { conf := make(core.Configuration) var err error @@ -77,11 +77,11 @@ func (g *Jira) Configure( var password string var serverURL string - if params.Token != "" || params.TokenStdin { - return nil, fmt.Errorf( - "JIRA session tokens are extremely short lived. We don't store them " + - "in the configuration, so they are not valid for this bridge.") - } + // if params.Token != "" || params.TokenStdin { + // return nil, fmt.Errorf( + // "JIRA session tokens are extremely short lived. We don't store them " + + // "in the configuration, so they are not valid for this bridge.") + // } if params.Owner != "" { return nil, fmt.Errorf("owner doesn't make sense for jira") @@ -137,7 +137,7 @@ func (g *Jira) Configure( return nil, err } - conf[core.KeyTarget] = target + conf[core.ConfigKeyTarget] = target conf[keyServer] = serverURL conf[keyProject] = project @@ -191,8 +191,8 @@ func (g *Jira) Configure( // ValidateConfig returns true if all required keys are present func (*Jira) ValidateConfig(conf core.Configuration) error { - if v, ok := conf[core.KeyTarget]; !ok { - return fmt.Errorf("missing %s key", core.KeyTarget) + if v, ok := conf[core.ConfigKeyTarget]; !ok { + return fmt.Errorf("missing %s key", core.ConfigKeyTarget) } else if v != target { return fmt.Errorf("unexpected target name: %v", v) } diff --git a/bridge/jira/export.go b/bridge/jira/export.go index 238252ee..f2b9d507 100644 --- a/bridge/jira/export.go +++ b/bridge/jira/export.go @@ -43,7 +43,8 @@ type jiraExporter struct { } // Init . -func (self *jiraExporter) Init(conf core.Configuration) error { +func (self *jiraExporter) Init(repo *cache.RepoCache, + conf core.Configuration) error { self.conf = conf self.identityClient = make(map[entity.Id]*Client) self.cachedOperationIDs = make(map[entity.Id]string) @@ -171,7 +172,7 @@ func (self *jiraExporter) exportBug( author := snapshot.Author // skip bug if it was imported from some other bug system - origin, ok := snapshot.GetCreateMetadata(core.KeyOrigin) + origin, ok := snapshot.GetCreateMetadata(core.MetaKeyOrigin) if ok && origin != target { out <- core.NewExportNothing( b.Id(), fmt.Sprintf("issue tagged with origin: %s", origin)) diff --git a/bridge/jira/import.go b/bridge/jira/import.go index 90ba5268..2337d8bd 100644 --- a/bridge/jira/import.go +++ b/bridge/jira/import.go @@ -35,7 +35,8 @@ type jiraImporter struct { } // Init . -func (gi *jiraImporter) Init(conf core.Configuration) error { +func (gi *jiraImporter) Init(repo *cache.RepoCache, + conf core.Configuration) error { gi.conf = conf return nil } @@ -217,10 +218,10 @@ func (self *jiraImporter) ensureIssue( cleanText, nil, map[string]string{ - core.KeyOrigin: target, - keyJiraID: issue.ID, - keyJiraKey: issue.Key, - keyJiraProject: self.conf[keyProject], + core.MetaKeyOrigin: target, + keyJiraID: issue.ID, + keyJiraKey: issue.Key, + keyJiraProject: self.conf[keyProject], }) if err != nil { return nil, err diff --git a/bridge/jira/jira.go b/bridge/jira/jira.go index 933c1239..accb9e7c 100644 --- a/bridge/jira/jira.go +++ b/bridge/jira/jira.go @@ -7,10 +7,6 @@ import ( "github.com/MichaelMure/git-bug/bridge/core" ) -func init() { - core.Register(&Jira{}) -} - // Jira Main object for the bridge type Jira struct{} |