MCPcopy Index your code
hub / github.com/git-bug/git-bug / ExportAll

Method ExportAll

bridge/gitlab/export.go:107–149  ·  view source on GitHub ↗

ExportAll export all event made by the current user to Gitlab

(ctx context.Context, repo *cache.RepoCache, since time.Time)

Source from the content-addressed store, hash-verified

105
106// ExportAll export all event made by the current user to Gitlab
107func (ge *gitlabExporter) ExportAll(ctx context.Context, repo *cache.RepoCache, since time.Time) (<-chan core.ExportResult, error) {
108 out := make(chan core.ExportResult)
109
110 go func() {
111 defer close(out)
112
113 allIdentitiesIds := make([]entity.Id, 0, len(ge.identityClient))
114 for id := range ge.identityClient {
115 allIdentitiesIds = append(allIdentitiesIds, id)
116 }
117
118 allBugsIds := repo.Bugs().AllIds()
119
120 for _, id := range allBugsIds {
121 select {
122 case <-ctx.Done():
123 return
124 default:
125 b, err := repo.Bugs().Resolve(id)
126 if err != nil {
127 out <- core.NewExportError(err, id)
128 return
129 }
130
131 snapshot := b.Snapshot()
132
133 // ignore issues created before since date
134 // TODO: compare the Lamport time instead of using the unix time
135 if snapshot.CreateTime.Before(since) {
136 out <- core.NewExportNothing(b.Id(), "bug created before the since date")
137 continue
138 }
139
140 if snapshot.HasAnyActor(allIdentitiesIds...) {
141 // try to export the bug and it associated events
142 ge.exportBug(ctx, b, out)
143 }
144 }
145 }
146 }()
147
148 return out, nil
149}
150
151// exportBug publish bugs and related events
152func (ge *gitlabExporter) exportBug(ctx context.Context, b *cache.BugCache, out chan<- core.ExportResult) {

Callers 1

TestGitlabPushPullFunction · 0.95

Calls 10

exportBugMethod · 0.95
NewExportErrorFunction · 0.92
NewExportNothingFunction · 0.92
closeFunction · 0.85
AllIdsMethod · 0.80
BugsMethod · 0.80
SnapshotMethod · 0.80
HasAnyActorMethod · 0.80
ResolveMethod · 0.65
IdMethod · 0.65

Tested by 1

TestGitlabPushPullFunction · 0.76