diff options
author | Amine <hilalyamine@gmail.com> | 2019-08-13 16:47:24 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-13 16:47:24 +0200 |
commit | cf960bc7a5bd0b7af28d35de33131fb0b5ce5253 (patch) | |
tree | 5df133c91bb4e1ccc5f9fbeb4664416b93d23bf5 /bridge/gitlab/import.go | |
parent | 146894a5657d3b20dbaf769a950b12bd19df499c (diff) | |
parent | c809d37152ea87a66fc281730042dcb4299a8263 (diff) | |
download | git-bug-cf960bc7a5bd0b7af28d35de33131fb0b5ce5253.tar.gz |
Merge pull request #193 from MichaelMure/immutableID
Future proof the operation's ID
Diffstat (limited to 'bridge/gitlab/import.go')
-rw-r--r-- | bridge/gitlab/import.go | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/bridge/gitlab/import.go b/bridge/gitlab/import.go index 360a585f..e135b8bc 100644 --- a/bridge/gitlab/import.go +++ b/bridge/gitlab/import.go @@ -10,8 +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/util/git" + "github.com/MichaelMure/git-bug/entity" "github.com/MichaelMure/git-bug/util/text" ) @@ -130,9 +129,9 @@ 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) + id, errResolve := b.ResolveOperationWithMetadata(keyGitlabId, gitlabID) if errResolve != nil && 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, }, ) @@ -327,7 +326,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 } |