diff options
author | Michael Muré <batolettre@gmail.com> | 2020-03-28 17:07:57 +0100 |
---|---|---|
committer | Michael Muré <batolettre@gmail.com> | 2020-03-28 17:07:57 +0100 |
commit | 4397766800fd02517501a969b8212708badd3312 (patch) | |
tree | 21df0ca5ecf6da865b38694dba6253c3a0a7dac9 | |
parent | 8389df0711dbd5cb13b187fa31ce0dbd5c781460 (diff) | |
download | git-bug-4397766800fd02517501a969b8212708badd3312.tar.gz |
jira: tag bugs with the base URL, tighten the matching
-rw-r--r-- | bridge/jira/import.go | 12 | ||||
-rw-r--r-- | bridge/jira/jira.go | 1 |
2 files changed, 12 insertions, 1 deletions
diff --git a/bridge/jira/import.go b/bridge/jira/import.go index 3d6d5414..b66b0fa3 100644 --- a/bridge/jira/import.go +++ b/bridge/jira/import.go @@ -216,7 +216,16 @@ func (ji *jiraImporter) ensureIssue(repo *cache.RepoCache, issue Issue) (*cache. return nil, err } - b, err := repo.ResolveBugCreateMetadata(metaKeyJiraId, issue.ID) + b, err := repo.ResolveBugMatcher(func(excerpt *cache.BugExcerpt) bool { + if _, ok := excerpt.CreateMetadata[metaKeyJiraBaseUrl]; ok && + excerpt.CreateMetadata[metaKeyJiraBaseUrl] != ji.conf[confKeyBaseUrl] { + return false + } + + return excerpt.CreateMetadata[core.MetaKeyOrigin] == target && + excerpt.CreateMetadata[metaKeyJiraId] == issue.ID && + excerpt.CreateMetadata[metaKeyJiraProject] == ji.conf[confKeyProject] + }) if err != nil && err != bug.ErrBugNotExist { return nil, err } @@ -241,6 +250,7 @@ func (ji *jiraImporter) ensureIssue(repo *cache.RepoCache, issue Issue) (*cache. metaKeyJiraId: issue.ID, metaKeyJiraKey: issue.Key, metaKeyJiraProject: ji.conf[confKeyProject], + metaKeyJiraBaseUrl: ji.conf[confKeyBaseUrl], }) if err != nil { return nil, err diff --git a/bridge/jira/jira.go b/bridge/jira/jira.go index 066c6597..6423843c 100644 --- a/bridge/jira/jira.go +++ b/bridge/jira/jira.go @@ -20,6 +20,7 @@ const ( metaKeyJiraKey = "jira-key" metaKeyJiraUser = "jira-user" metaKeyJiraProject = "jira-project" + metaKeyJiraBaseUrl = "jira-base-url" metaKeyJiraExportTime = "jira-export-time" metaKeyJiraLogin = "jira-login" |