From 612a29b031c0f2914d8b283b99bf187f20182fa9 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Wed, 7 Aug 2019 19:14:12 +0200 Subject: fix everything following the hash-->id change --- bridge/gitlab/import.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'bridge/gitlab/import.go') diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index dbedfda8..8b389357 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -11,7 +11,6 @@ import ( "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/cache" "github.com/MichaelMure/git-bug/identity" - "github.com/MichaelMure/git-bug/util/git" "github.com/MichaelMure/git-bug/util/text" ) @@ -130,10 +129,10 @@ func (gi *gitlabImporter) ensureIssue(repo *cache.RepoCache, issue *gitlab.Issue } func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, note *gitlab.Note) error { - id := parseID(note.ID) + gitlabID := parseID(note.ID) - hash, errResolve := b.ResolveOperationWithMetadata(keyGitlabId, id) - if errResolve != nil && errResolve != cache.ErrNoMatchingOp { + id, errResolve := b.ResolveOperationWithMetadata(keyGitlabId, gitlabID) + if errResolve != cache.ErrNoMatchingOp { return errResolve } @@ -154,7 +153,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n author, note.CreatedAt.Unix(), map[string]string{ - keyGitlabId: id, + keyGitlabId: gitlabID, }, ) return err @@ -168,7 +167,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n author, note.CreatedAt.Unix(), map[string]string{ - keyGitlabId: id, + keyGitlabId: gitlabID, }, ) return err @@ -185,10 +184,10 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n _, err = b.EditCommentRaw( author, note.UpdatedAt.Unix(), - git.Hash(firstComment.Id()), + firstComment.Id(), issue.Description, map[string]string{ - keyGitlabId: id, + keyGitlabId: gitlabID, }, ) @@ -211,7 +210,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n cleanText, nil, map[string]string{ - keyGitlabId: id, + keyGitlabId: gitlabID, }, ) @@ -221,7 +220,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n // if comment was already exported // search for last comment update - comment, err := b.Snapshot().SearchComment(hash) + comment, err := b.Snapshot().SearchComment(id) if err != nil { return err } @@ -232,7 +231,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n _, err = b.EditCommentRaw( author, note.UpdatedAt.Unix(), - git.Hash(comment.Id()), + comment.Id(), cleanText, nil, ) @@ -253,7 +252,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n note.CreatedAt.Unix(), body, map[string]string{ - keyGitlabId: id, + keyGitlabId: gitlabID, }, ) -- cgit From 99b5c58d43137bd9f6503788a55484327b0c531f Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Mon, 12 Aug 2019 16:12:14 +0200 Subject: finish the refactoring for the dedicated identifier type --- bridge/gitlab/import.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'bridge/gitlab/import.go') diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index 8b389357..08e4c6eb 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -10,7 +10,7 @@ import ( "github.com/MichaelMure/git-bug/bridge/core" "github.com/MichaelMure/git-bug/bug" "github.com/MichaelMure/git-bug/cache" - "github.com/MichaelMure/git-bug/identity" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/util/text" ) @@ -324,7 +324,7 @@ func (gi *gitlabImporter) ensurePerson(repo *cache.RepoCache, id int) (*cache.Id if err == nil { return i, nil } - if _, ok := err.(identity.ErrMultipleMatch); ok { + if _, ok := err.(entity.ErrMultipleMatch); ok { return nil, err } -- cgit From c809d37152ea87a66fc281730042dcb4299a8263 Mon Sep 17 00:00:00 2001 From: Michael Muré Date: Tue, 13 Aug 2019 16:02:13 +0200 Subject: more hash-->id fixes --- bridge/gitlab/import.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bridge/gitlab/import.go') diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index 08e4c6eb..f65aba6a 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -132,7 +132,7 @@ func (gi *gitlabImporter) ensureNote(repo *cache.RepoCache, b *cache.BugCache, n gitlabID := parseID(note.ID) id, errResolve := b.ResolveOperationWithMetadata(keyGitlabId, gitlabID) - if errResolve != cache.ErrNoMatchingOp { + if errResolve != nil && errResolve != cache.ErrNoMatchingOp { return errResolve } -- cgit