From 0ac39a7ab5db077fcf0df827e32bf6e625e980da Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Sat, 19 Nov 2022 11:33:12 +0100 Subject: WIP --- bridge/jira/export.go | 2 +- bridge/jira/import.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'bridge/jira') 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(), -- cgit From 9b98fc06489353053564b431ac0c0d73a5c55a56 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 21 Dec 2022 21:54:36 +0100 Subject: cache: tie up the refactor up to compiling --- bridge/jira/export.go | 7 +++---- bridge/jira/import.go | 8 ++++---- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'bridge/jira') diff --git a/bridge/jira/export.go b/bridge/jira/export.go index 10b6823d..95f9e28c 100644 --- a/bridge/jira/export.go +++ b/bridge/jira/export.go @@ -14,7 +14,6 @@ import ( "github.com/MichaelMure/git-bug/bridge/core/auth" "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/entities/bug" - "github.com/MichaelMure/git-bug/entities/identity" "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/entity/dag" ) @@ -102,7 +101,7 @@ func (je *jiraExporter) cacheAllClient(ctx context.Context, repo *cache.RepoCach continue } - user, err := repo.ResolveIdentityImmutableMetadata(metaKeyJiraLogin, login) + user, err := repo.Identities().ResolveIdentityImmutableMetadata(metaKeyJiraLogin, login) if entity.IsErrNotFound(err) { continue } @@ -146,10 +145,10 @@ func (je *jiraExporter) ExportAll(ctx context.Context, repo *cache.RepoCache, si allIdentitiesIds = append(allIdentitiesIds, id) } - allBugsIds := repo.AllBugsIds() + allBugsIds := repo.Bugs().AllIds() for _, id := range allBugsIds { - b, err := repo.ResolveBug(id) + b, err := repo.Bugs().Resolve(id) if err != nil { out <- core.NewExportError(errors.Wrap(err, "can't load bug"), id) return diff --git a/bridge/jira/import.go b/bridge/jira/import.go index 4cec1133..d8a5f8dd 100644 --- a/bridge/jira/import.go +++ b/bridge/jira/import.go @@ -184,7 +184,7 @@ func (ji *jiraImporter) ImportAll(ctx context.Context, repo *cache.RepoCache, si // Create a bug.Person from a JIRA user func (ji *jiraImporter) ensurePerson(repo *cache.RepoCache, user User) (*cache.IdentityCache, error) { // Look first in the cache - i, err := repo.ResolveIdentityImmutableMetadata( + i, err := repo.Identities().ResolveIdentityImmutableMetadata( metaKeyJiraUser, string(user.Key)) if err == nil { return i, nil @@ -193,7 +193,7 @@ func (ji *jiraImporter) ensurePerson(repo *cache.RepoCache, user User) (*cache.I return nil, err } - i, err = repo.NewIdentityRaw( + i, err = repo.Identities().NewRaw( user.DisplayName, user.EmailAddress, user.Key, @@ -219,7 +219,7 @@ func (ji *jiraImporter) ensureIssue(repo *cache.RepoCache, issue Issue) (*cache. return nil, err } - b, err := repo.ResolveBugMatcher(func(excerpt *cache.BugExcerpt) bool { + b, err := repo.Bugs().ResolveMatcher(func(excerpt *cache.BugExcerpt) bool { if _, ok := excerpt.CreateMetadata[metaKeyJiraBaseUrl]; ok && excerpt.CreateMetadata[metaKeyJiraBaseUrl] != ji.conf[confKeyBaseUrl] { return false @@ -234,7 +234,7 @@ func (ji *jiraImporter) ensureIssue(repo *cache.RepoCache, issue Issue) (*cache. } if entity.IsErrNotFound(err) { - b, _, err = repo.NewBugRaw( + b, _, err = repo.Bugs().NewRaw( author, issue.Fields.Created.Unix(), text.CleanupOneLine(issue.Fields.Summary), -- cgit