From 0ac39a7ab5db077fcf0df827e32bf6e625e980da Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 19 Nov 2022 11:33:12 +0100 Subject: WIP --- bridge/core/config.go | 3 ++- bridge/github/export.go | 2 +- bridge/github/import.go | 2 +- bridge/gitlab/export.go | 2 +- bridge/gitlab/import.go | 2 +- bridge/jira/export.go | 2 +- bridge/jira/import.go | 4 ++-- bridge/launchpad/import.go | 4 ++-- 8 files changed, 11 insertions(+), 10 deletions(-) (limited to 'bridge') diff --git a/bridge/core/config.go b/bridge/core/config.go index 45f1afa4..8ad7b965 100644 --- a/bridge/core/config.go +++ b/bridge/core/config.go @@ -5,12 +5,13 @@ import ( "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/entities/identity" + "github.com/MichaelMure/git-bug/entity" ) func FinishConfig(repo *cache.RepoCache, metaKey string, login string) error { // if no user exist with the given login metadata _, err := repo.ResolveIdentityImmutableMetadata(metaKey, login) - if err != nil && err != identity.ErrIdentityNotExist { + if err != nil && !entity.IsErrNotFound(err) { // real error return err } diff --git a/bridge/github/export.go b/bridge/github/export.go index 675ed039..5d1d8661 100644 --- a/bridge/github/export.go +++ b/bridge/github/export.go @@ -90,7 +90,7 @@ func (ge *githubExporter) cacheAllClient(repo *cache.RepoCache) error { } user, err := repo.ResolveIdentityImmutableMetadata(metaKeyGithubLogin, login) - if err == identity.ErrIdentityNotExist { + if entity.IsErrNotFound(err) { continue } if err != nil { diff --git a/bridge/github/import.go b/bridge/github/import.go index 7ccac3fb..a64b7b27 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -190,7 +190,7 @@ func (gi *githubImporter) ensureIssue(ctx context.Context, repo *cache.RepoCache if err == nil { return b, nil } - if err != bug.ErrBugNotExist { + if !entity.IsErrNotFound(err) { return nil, err } diff --git a/bridge/gitlab/export.go b/bridge/gitlab/export.go index 83465428..19b8d496 100644 --- a/bridge/gitlab/export.go +++ b/bridge/gitlab/export.go @@ -75,7 +75,7 @@ func (ge *gitlabExporter) cacheAllClient(repo *cache.RepoCache, baseURL string) } user, err := repo.ResolveIdentityImmutableMetadata(metaKeyGitlabLogin, login) - if err == identity.ErrIdentityNotExist { + if entity.IsErrNotFound(err) { continue } if err != nil { diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index c7909c8f..85999e90 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -118,7 +118,7 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue if err == nil { return b, nil } - if err != bug.ErrBugNotExist { + if !entity.IsErrNotFound(err) { return nil, err } diff --git a/bridge/jira/export.go b/bridge/jira/export.go index 8587a55d..10b6823d 100644 --- a/bridge/jira/export.go +++ b/bridge/jira/export.go @@ -103,7 +103,7 @@ func (je *jiraExporter) cacheAllClient(ctx context.Context, repo *cache.RepoCach } user, err := repo.ResolveIdentityImmutableMetadata(metaKeyJiraLogin, login) - if err == identity.ErrIdentityNotExist { + if entity.IsErrNotFound(err) { continue } if err != nil { diff --git a/bridge/jira/import.go b/bridge/jira/import.go index ff9fbb7a..4cec1133 100644 --- a/bridge/jira/import.go +++ b/bridge/jira/import.go @@ -229,11 +229,11 @@ func (ji *jiraImporter) ensureIssue(repo *cache.RepoCache, issue Issue) (*cache. excerpt.CreateMetadata[metaKeyJiraId] == issue.ID && excerpt.CreateMetadata[metaKeyJiraProject] == ji.conf[confKeyProject] }) - if err != nil && err != bug.ErrBugNotExist { + if err != nil && !entity.IsErrNotFound(err) { return nil, err } - if err == bug.ErrBugNotExist { + if entity.IsErrNotFound(err) { b, _, err = repo.NewBugRaw( author, issue.Fields.Created.Unix(), diff --git a/bridge/launchpad/import.go b/bridge/launchpad/import.go index f81e3582..0f8ecf9f 100644 --- a/bridge/launchpad/import.go +++ b/bridge/launchpad/import.go @@ -68,7 +68,7 @@ func (li *launchpadImporter) ImportAll(ctx context.Context, repo *cache.RepoCach return excerpt.CreateMetadata[core.MetaKeyOrigin] == target && excerpt.CreateMetadata[metaKeyLaunchpadID] == lpBugID }) - if err != nil && err != bug.ErrBugNotExist { + if err != nil && !entity.IsErrNotFound(err) { out <- core.NewImportError(err, entity.Id(lpBugID)) return } @@ -79,7 +79,7 @@ func (li *launchpadImporter) ImportAll(ctx context.Context, repo *cache.RepoCach return } - if err == bug.ErrBugNotExist { + if entity.IsErrNotFound(err) { createdAt, _ := time.Parse(time.RFC3339, lpBug.CreatedAt) b, _, err = repo.NewBugRaw( owner, -- cgit