aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bridge/github/import.go5
-rw-r--r--bridge/gitlab/import.go7
-rw-r--r--bridge/gitlab/import_test.go8
-rw-r--r--bridge/jira/import.go12
-rw-r--r--bridge/jira/jira.go1
-rw-r--r--bridge/launchpad/import.go5
6 files changed, 30 insertions, 8 deletions
diff --git a/bridge/github/import.go b/bridge/github/import.go
index a74c49c5..78e93436 100644
--- a/bridge/github/import.go
+++ b/bridge/github/import.go
@@ -108,7 +108,10 @@ func (gi *githubImporter) ensureIssue(repo *cache.RepoCache, issue issueTimeline
}
// resolve bug
- b, err := repo.ResolveBugCreateMetadata(metaKeyGithubUrl, issue.Url.String())
+ b, err := repo.ResolveBugMatcher(func(excerpt *cache.BugExcerpt) bool {
+ return excerpt.CreateMetadata[core.MetaKeyOrigin] == target &&
+ excerpt.CreateMetadata[metaKeyGithubId] == parseId(issue.Id)
+ })
if err != nil && err != bug.ErrBugNotExist {
return nil, err
}
diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go
index 5ed5f0e3..0a47a783 100644
--- a/bridge/gitlab/import.go
+++ b/bridge/gitlab/import.go
@@ -123,7 +123,12 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue
}
// resolve bug
- b, err := repo.ResolveBugCreateMetadata(metaKeyGitlabUrl, issue.WebURL)
+ b, err := repo.ResolveBugMatcher(func(excerpt *cache.BugExcerpt) bool {
+ return excerpt.CreateMetadata[core.MetaKeyOrigin] == target &&
+ excerpt.CreateMetadata[metaKeyGitlabId] == parseID(issue.IID) &&
+ excerpt.CreateMetadata[metaKeyGitlabBaseUrl] == gi.conf[confKeyProjectID] &&
+ excerpt.CreateMetadata[metaKeyGitlabProject] == gi.conf[confKeyGitlabBaseUrl]
+ })
if err == nil {
return b, nil
}
diff --git a/bridge/gitlab/import_test.go b/bridge/gitlab/import_test.go
index f916d20c..42a37cda 100644
--- a/bridge/gitlab/import_test.go
+++ b/bridge/gitlab/import_test.go
@@ -29,7 +29,7 @@ func TestImport(t *testing.T) {
}{
{
name: "simple issue",
- url: "https://gitlab.com/git-bug/test/issues/1",
+ url: "https://gitlab.com/git-bug/test/-/issues/1",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "simple issue", "initial comment", nil),
@@ -40,7 +40,7 @@ func TestImport(t *testing.T) {
},
{
name: "empty issue",
- url: "https://gitlab.com/git-bug/test/issues/2",
+ url: "https://gitlab.com/git-bug/test/-/issues/2",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "empty issue", "", nil),
@@ -49,7 +49,7 @@ func TestImport(t *testing.T) {
},
{
name: "complex issue",
- url: "https://gitlab.com/git-bug/test/issues/3",
+ url: "https://gitlab.com/git-bug/test/-/issues/3",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "complex issue", "initial comment", nil),
@@ -66,7 +66,7 @@ func TestImport(t *testing.T) {
},
{
name: "editions",
- url: "https://gitlab.com/git-bug/test/issues/4",
+ url: "https://gitlab.com/git-bug/test/-/issues/4",
bug: &bug.Snapshot{
Operations: []bug.Operation{
bug.NewCreateOp(author, 0, "editions", "initial comment edited", nil),
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"
diff --git a/bridge/launchpad/import.go b/bridge/launchpad/import.go
index 3b6d7fe0..7f528c7d 100644
--- a/bridge/launchpad/import.go
+++ b/bridge/launchpad/import.go
@@ -62,7 +62,10 @@ func (li *launchpadImporter) ImportAll(ctx context.Context, repo *cache.RepoCach
return
default:
lpBugID := fmt.Sprintf("%d", lpBug.ID)
- b, err := repo.ResolveBugCreateMetadata(metaKeyLaunchpadID, lpBugID)
+ b, err := repo.ResolveBugMatcher(func(excerpt *cache.BugExcerpt) bool {
+ return excerpt.CreateMetadata[core.MetaKeyOrigin] == target &&
+ excerpt.CreateMetadata[metaKeyLaunchpadID] == lpBugID
+ })
if err != nil && err != bug.ErrBugNotExist {
out <- core.NewImportError(err, entity.Id(lpBugID))
return