repair after rebase

This commit is contained in:
Josh Bialkowski 2019-12-18 07:49:49 -08:00
parent 3384d1b26b
commit dca85b309a
5 changed files with 20 additions and 22 deletions

View File

@ -13,8 +13,8 @@ import (
"github.com/pkg/errors" "github.com/pkg/errors"
"github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/bridge/core"
"github.com/MichaelMure/git-bug/cache"
"github.com/MichaelMure/git-bug/input" "github.com/MichaelMure/git-bug/input"
"github.com/MichaelMure/git-bug/repository"
) )
const ( const (
@ -66,7 +66,7 @@ How would you like to store your JIRA login credentials?
// Configure sets up the bridge configuration // Configure sets up the bridge configuration
func (g *Jira) Configure( func (g *Jira) Configure(
repo repository.RepoCommon, params core.BridgeParams) ( repo *cache.RepoCache, params core.BridgeParams) (
core.Configuration, error) { core.Configuration, error) {
conf := make(core.Configuration) conf := make(core.Configuration)
var err error var err error
@ -77,11 +77,11 @@ func (g *Jira) Configure(
var password string var password string
var serverURL string var serverURL string
if params.Token != "" || params.TokenStdin { // if params.Token != "" || params.TokenStdin {
return nil, fmt.Errorf( // return nil, fmt.Errorf(
"JIRA session tokens are extremely short lived. We don't store them " + // "JIRA session tokens are extremely short lived. We don't store them " +
"in the configuration, so they are not valid for this bridge.") // "in the configuration, so they are not valid for this bridge.")
} // }
if params.Owner != "" { if params.Owner != "" {
return nil, fmt.Errorf("owner doesn't make sense for jira") return nil, fmt.Errorf("owner doesn't make sense for jira")
@ -137,7 +137,7 @@ func (g *Jira) Configure(
return nil, err return nil, err
} }
conf[core.KeyTarget] = target conf[core.ConfigKeyTarget] = target
conf[keyServer] = serverURL conf[keyServer] = serverURL
conf[keyProject] = project conf[keyProject] = project
@ -191,8 +191,8 @@ func (g *Jira) Configure(
// ValidateConfig returns true if all required keys are present // ValidateConfig returns true if all required keys are present
func (*Jira) ValidateConfig(conf core.Configuration) error { func (*Jira) ValidateConfig(conf core.Configuration) error {
if v, ok := conf[core.KeyTarget]; !ok { if v, ok := conf[core.ConfigKeyTarget]; !ok {
return fmt.Errorf("missing %s key", core.KeyTarget) return fmt.Errorf("missing %s key", core.ConfigKeyTarget)
} else if v != target { } else if v != target {
return fmt.Errorf("unexpected target name: %v", v) return fmt.Errorf("unexpected target name: %v", v)
} }

View File

@ -43,7 +43,8 @@ type jiraExporter struct {
} }
// Init . // Init .
func (self *jiraExporter) Init(conf core.Configuration) error { func (self *jiraExporter) Init(repo *cache.RepoCache,
conf core.Configuration) error {
self.conf = conf self.conf = conf
self.identityClient = make(map[entity.Id]*Client) self.identityClient = make(map[entity.Id]*Client)
self.cachedOperationIDs = make(map[entity.Id]string) self.cachedOperationIDs = make(map[entity.Id]string)
@ -171,7 +172,7 @@ func (self *jiraExporter) exportBug(
author := snapshot.Author author := snapshot.Author
// skip bug if it was imported from some other bug system // 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 { if ok && origin != target {
out <- core.NewExportNothing( out <- core.NewExportNothing(
b.Id(), fmt.Sprintf("issue tagged with origin: %s", origin)) b.Id(), fmt.Sprintf("issue tagged with origin: %s", origin))

View File

@ -35,7 +35,8 @@ type jiraImporter struct {
} }
// Init . // Init .
func (gi *jiraImporter) Init(conf core.Configuration) error { func (gi *jiraImporter) Init(repo *cache.RepoCache,
conf core.Configuration) error {
gi.conf = conf gi.conf = conf
return nil return nil
} }
@ -217,7 +218,7 @@ func (self *jiraImporter) ensureIssue(
cleanText, cleanText,
nil, nil,
map[string]string{ map[string]string{
core.KeyOrigin: target, core.MetaKeyOrigin: target,
keyJiraID: issue.ID, keyJiraID: issue.ID,
keyJiraKey: issue.Key, keyJiraKey: issue.Key,
keyJiraProject: self.conf[keyProject], keyJiraProject: self.conf[keyProject],

View File

@ -7,10 +7,6 @@ import (
"github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/bridge/core"
) )
func init() {
core.Register(&Jira{})
}
// Jira Main object for the bridge // Jira Main object for the bridge
type Jira struct{} type Jira struct{}

View File

@ -71,7 +71,7 @@ git bug bridge configure \
``` ```
-n, --name string A distinctive name to identify the bridge -n, --name string A distinctive name to identify the bridge
-t, --target string The target of the bridge. Valid values are [github,gitlab,launchpad-preview] -t, --target string The target of the bridge. Valid values are [github,gitlab,jira,launchpad-preview]
-u, --url string The URL of the target repository -u, --url string The URL of the target repository
-b, --base-url string The base URL of your issue tracker service -b, --base-url string The base URL of your issue tracker service
-o, --owner string The owner of the target repository -o, --owner string The owner of the target repository