diff options
author | Amine Hilaly <hilalyamine@gmail.com> | 2019-05-10 12:02:44 +0200 |
---|---|---|
committer | Amine Hilaly <hilalyamine@gmail.com> | 2019-05-23 14:21:44 +0200 |
commit | 12f6fd61be835ca37e6a4e8a17abd4b8175e6ba0 (patch) | |
tree | b3b68f6c38133ec0e6f24101ce92a12dcf86fed0 | |
parent | b6dfd4560268b685764f49b465da6dffd6cc29c8 (diff) | |
download | git-bug-12f6fd61be835ca37e6a4e8a17abd4b8175e6ba0.tar.gz |
call NextIssueEdit from ensureIssue
-rw-r--r-- | bridge/github/import.go | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/bridge/github/import.go b/bridge/github/import.go index 2cdd7579..da0ca2fe 100644 --- a/bridge/github/import.go +++ b/bridge/github/import.go @@ -54,22 +54,15 @@ func (gi *githubImporter) ImportAll(repo *cache.RepoCache, since time.Time) erro fmt.Printf("importing issue: %v %v\n", gi.importedIssues+1, issue.Title) gi.importedIssues++ - // get issue edits - issueEdits := []userContentEdit{} - for gi.iterator.NextIssueEdit() { - issueEdits = append(issueEdits, gi.iterator.IssueEditValue()) - } - // create issue - b, err := gi.ensureIssue(repo, issue, issueEdits) + b, err := gi.ensureIssue(repo, issue) if err != nil { return fmt.Errorf("issue creation: %v", err) } // loop over timeline items for gi.iterator.NextTimeline() { - item := gi.iterator.TimelineValue() - if err := gi.ensureTimelineItem(repo, b, item); err != nil { + if err := gi.ensureTimelineItem(repo, b, gi.iterator.TimelineValue()); err != nil { return fmt.Errorf("timeline event creation: %v", err) } } @@ -90,7 +83,7 @@ func (gi *githubImporter) ImportAll(repo *cache.RepoCache, since time.Time) erro return nil } -func (gi *githubImporter) ensureIssue(repo *cache.RepoCache, issue issueTimeline, issueEdits []userContentEdit) (*cache.BugCache, error) { +func (gi *githubImporter) ensureIssue(repo *cache.RepoCache, issue issueTimeline) (*cache.BugCache, error) { // ensure issue author author, err := gi.ensurePerson(repo, issue.Author) if err != nil { @@ -103,6 +96,12 @@ func (gi *githubImporter) ensureIssue(repo *cache.RepoCache, issue issueTimeline return nil, err } + // get issue edits + issueEdits := []userContentEdit{} + for gi.iterator.NextIssueEdit() { + issueEdits = append(issueEdits, gi.iterator.IssueEditValue()) + } + // if issueEdits is empty if len(issueEdits) == 0 { if err == bug.ErrBugNotExist { |