diff options
-rw-r--r-- | bridge/core/bridge.go | 28 | ||||
-rw-r--r-- | commands/bridge_push.go | 16 |
2 files changed, 20 insertions, 24 deletions
diff --git a/bridge/core/bridge.go b/bridge/core/bridge.go index 3a36dfaa..1cad10e9 100644 --- a/bridge/core/bridge.go +++ b/bridge/core/bridge.go @@ -365,39 +365,21 @@ func (b *Bridge) ImportAll(ctx context.Context) (<-chan ImportResult, error) { return b.ImportAllSince(ctx, time.Time{}) } -func (b *Bridge) ExportAll(ctx context.Context, since time.Time) error { +func (b *Bridge) ExportAll(ctx context.Context, since time.Time) (<-chan ExportResult, error) { exporter := b.getExporter() if exporter == nil { - return ErrExportNotSupported + return nil, ErrExportNotSupported } err := b.ensureConfig() if err != nil { - return err + return nil, err } err = b.ensureInit() if err != nil { - return err - } - - events, err := exporter.ExportAll(ctx, b.repo, since) - if err != nil { - return err - } - - exportedIssues := 0 - for result := range events { - if result.Event != ExportEventNothing { - fmt.Println(result.String()) - } - - switch result.Event { - case ExportEventBug: - exportedIssues++ - } + return nil, err } - fmt.Printf("exported %d issues with %s bridge\n", exportedIssues, b.Name) - return nil + return exporter.ExportAll(ctx, b.repo, since) } diff --git a/commands/bridge_push.go b/commands/bridge_push.go index 26f42dc4..95ad5f5e 100644 --- a/commands/bridge_push.go +++ b/commands/bridge_push.go @@ -63,11 +63,25 @@ func runBridgePush(cmd *cobra.Command, args []string) error { return nil }) - err = b.ExportAll(ctx, time.Time{}) + events, err := b.ExportAll(ctx, time.Time{}) if err != nil { return err } + exportedIssues := 0 + for result := range events { + if result.Event != core.ExportEventNothing { + fmt.Println(result.String()) + } + + switch result.Event { + case core.ExportEventBug: + exportedIssues++ + } + } + + fmt.Printf("exported %d issues with %s bridge\n", exportedIssues, b.Name) + // send done signal close(done) return nil |