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/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)
}

View File

@ -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))

View File

@ -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

View File

@ -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{}

View File

@ -71,7 +71,7 @@ git bug bridge configure \
```
-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
-b, --base-url string The base URL of your issue tracker service
-o, --owner string The owner of the target repository