|
|
@ -111,12 +111,6 @@ func (fm *FetchMigratory) MigrateIssuesFromGitHub() error { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if fm.Options.Comments { |
|
|
|
if fm.Options.Comments { |
|
|
|
return fm.MigrateCommentsFromGitHub() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (fm *FetchMigratory) MigrateCommentsFromGitHub() error { |
|
|
|
|
|
|
|
var comments []*github.IssueComment |
|
|
|
var comments []*github.IssueComment |
|
|
|
var cmts *[]*github.IssueComment |
|
|
|
var cmts *[]*github.IssueComment |
|
|
|
if cmts = <-commentsChan; cmts == nil { |
|
|
|
if cmts = <-commentsChan; cmts == nil { |
|
|
@ -127,15 +121,12 @@ func (fm *FetchMigratory) MigrateCommentsFromGitHub() error { |
|
|
|
}).Errorf("migration failed: %v", fm.Status.FatalError) |
|
|
|
}).Errorf("migration failed: %v", fm.Status.FatalError) |
|
|
|
return err |
|
|
|
return err |
|
|
|
} |
|
|
|
} |
|
|
|
comments = *cmts |
|
|
|
return fm.migrateCommentsFromGitHub(comments, migratedIssues) |
|
|
|
if err != nil { |
|
|
|
|
|
|
|
fm.Status.Stage = Failed |
|
|
|
|
|
|
|
fm.Status.FatalError = err |
|
|
|
|
|
|
|
fm.Logger.WithFields(logrus.Fields{ |
|
|
|
|
|
|
|
"repo": fmt.Sprintf("%s/%s", fm.RepoOwner, fm.RepoName), |
|
|
|
|
|
|
|
}).Errorf("migration failed: %v", fm.Status.FatalError) |
|
|
|
|
|
|
|
return err |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return nil |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func (fm *FetchMigratory) migrateCommentsFromGitHub(comments []*github.IssueComment, migratedIssues map[int]*gitea.Issue) error { |
|
|
|
fm.Status.Comments = int64(len(comments)) |
|
|
|
fm.Status.Comments = int64(len(comments)) |
|
|
|
commentsByIssue := make(map[*gitea.Issue][]*github.IssueComment, len(migratedIssues)) |
|
|
|
commentsByIssue := make(map[*gitea.Issue][]*github.IssueComment, len(migratedIssues)) |
|
|
|
for _, comment := range comments { |
|
|
|
for _, comment := range comments { |
|
|
@ -183,6 +174,7 @@ func (fm *FetchMigratory) MigrateCommentsFromGitHub() error { |
|
|
|
}(issue, comms) |
|
|
|
}(issue, comms) |
|
|
|
} |
|
|
|
} |
|
|
|
wg.Wait() |
|
|
|
wg.Wait() |
|
|
|
|
|
|
|
return nil |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
var issueIndexRegex = regexp.MustCompile(`/(issues|pull)/([0-9]+)#`) |
|
|
|
var issueIndexRegex = regexp.MustCompile(`/(issues|pull)/([0-9]+)#`) |
|
|
|