diff options
author | Michael Muré <batolettre@gmail.com> | 2019-11-19 21:13:13 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-19 21:13:13 +0100 |
commit | dcf3feb0b5a30de47a29557c63cf3d67602753ee (patch) | |
tree | 0e7f3a6b94974869b4eaae40c6bf39a1214dc855 /bridge/gitlab/export.go | |
parent | 22085f30d3ddb51f8192c0776cf4c82749ab2cab (diff) | |
parent | d6d5978b6dbba1adffd91ff8b86bd5e8465978f5 (diff) | |
download | git-bug-dcf3feb0b5a30de47a29557c63cf3d67602753ee.tar.gz |
Merge pull request #254 from MichaelMure/import-events
Bridge: correctly emit NothingEvents
Diffstat (limited to 'bridge/gitlab/export.go')
-rw-r--r-- | bridge/gitlab/export.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/bridge/gitlab/export.go b/bridge/gitlab/export.go index 44778b44..7c00e39d 100644 --- a/bridge/gitlab/export.go +++ b/bridge/gitlab/export.go @@ -117,8 +117,6 @@ func (ge *gitlabExporter) ExportAll(ctx context.Context, repo *cache.RepoCache, if snapshot.HasAnyActor(allIdentitiesIds...) { // try to export the bug and it associated events ge.exportBug(ctx, b, since, out) - } else { - out <- core.NewExportNothing(id, "not an actor") } } } @@ -131,6 +129,7 @@ func (ge *gitlabExporter) ExportAll(ctx context.Context, repo *cache.RepoCache, func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, since time.Time, out chan<- core.ExportResult) { snapshot := b.Snapshot() + var bugUpdated bool var err error var bugGitlabID int var bugGitlabIDString string @@ -166,8 +165,6 @@ func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, sinc return } - out <- core.NewExportNothing(b.Id(), "bug already exported") - // will be used to mark operation related to a bug as exported bugGitlabIDString = gitlabID bugGitlabID, err = strconv.Atoi(bugGitlabIDString) @@ -237,14 +234,12 @@ func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, sinc // cache the ID of already exported or imported issues and events from Gitlab if id, ok := op.GetMetadata(metaKeyGitlabId); ok { ge.cachedOperationIDs[op.Id().String()] = id - out <- core.NewExportNothing(op.Id(), "already exported operation") continue } opAuthor := op.GetAuthor() client, err := ge.getIdentityClient(opAuthor.Id()) if err != nil { - out <- core.NewExportNothing(op.Id(), "missing operation author token") continue } @@ -371,6 +366,12 @@ func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, sinc out <- core.NewExportError(err, b.Id()) return } + + bugUpdated = true + } + + if !bugUpdated { + out <- core.NewExportNothing(b.Id(), "nothing has been exported") } } |