summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2020-10-27 21:34:56 +0000
committerGitHub <noreply@github.com>2020-10-27 17:34:56 -0400
commit7dfb2fc176a3d0d864b52b3124a795781cbd73e5 (patch)
treead42ccd751788246a7a454547ccd770c6150d900 /modules
parent6c2c521ba5f557ed3ed6117dd6801f6d69cc1e6d (diff)
downloadgitea-7dfb2fc176a3d0d864b52b3124a795781cbd73e5.tar.gz
gitea-7dfb2fc176a3d0d864b52b3124a795781cbd73e5.zip
Add migrated pulls to pull request task queue (#13331)
* Add migrated pulls to pull request task queue Fix #13321 Signed-off-by: Andrew Thornton <art27@cantab.net> * Improve error reports Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Diffstat (limited to 'modules')
-rw-r--r--modules/migrations/gitea_downloader.go16
-rw-r--r--modules/migrations/gitea_uploader.go2
2 files changed, 10 insertions, 8 deletions
diff --git a/modules/migrations/gitea_downloader.go b/modules/migrations/gitea_downloader.go
index 8299c040b0..1531153f2e 100644
--- a/modules/migrations/gitea_downloader.go
+++ b/modules/migrations/gitea_downloader.go
@@ -47,7 +47,7 @@ func (f *GiteaDownloaderFactory) New(ctx context.Context, opts base.MigrateOptio
path := strings.Split(repoNameSpace, "/")
if len(path) < 2 {
- return nil, fmt.Errorf("invalid path")
+ return nil, fmt.Errorf("invalid path: %s", repoNameSpace)
}
repoPath := strings.Join(path[len(path)-2:], "/")
@@ -87,7 +87,7 @@ func NewGiteaDownloader(ctx context.Context, baseURL, repoPath, username, passwo
gitea_sdk.SetContext(ctx),
)
if err != nil {
- log.Error(fmt.Sprintf("NewGiteaDownloader: %s", err.Error()))
+ log.Error(fmt.Sprintf("Failed to create NewGiteaDownloader for: %s. Error: %v", baseURL, err))
return nil, err
}
@@ -395,7 +395,7 @@ func (g *GiteaDownloader) GetIssues(page, perPage int) ([]*base.Issue, bool, err
reactions, err := g.getIssueReactions(issue.Index)
if err != nil {
- return nil, false, fmt.Errorf("error while loading reactions: %v", err)
+ return nil, false, fmt.Errorf("error while loading reactions for issue #%d. Error: %v", issue.Index, err)
}
var assignees []string
@@ -446,13 +446,13 @@ func (g *GiteaDownloader) GetComments(index int64) ([]*base.Comment, error) {
// Page: i,
}})
if err != nil {
- return nil, fmt.Errorf("error while listing comments: %v", err)
+ return nil, fmt.Errorf("error while listing comments for issue #%d. Error: %v", index, err)
}
for _, comment := range comments {
reactions, err := g.getCommentReactions(comment.ID)
if err != nil {
- return nil, fmt.Errorf("error while listing comment creactions: %v", err)
+ return nil, fmt.Errorf("error while listing reactions for comment %d in issue #%d. Error: %v", comment.ID, index, err)
}
allComments = append(allComments, &base.Comment{
@@ -490,7 +490,7 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques
State: gitea_sdk.StateAll,
})
if err != nil {
- return nil, false, fmt.Errorf("error while listing repos: %v", err)
+ return nil, false, fmt.Errorf("error while listing pull requests (page: %d, pagesize: %d). Error: %v", page, perPage, err)
}
for _, pr := range prs {
var milestone string
@@ -521,7 +521,7 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques
if headSHA == "" {
headCommit, _, err := g.client.GetSingleCommit(g.repoOwner, g.repoName, url.PathEscape(pr.Head.Ref))
if err != nil {
- return nil, false, fmt.Errorf("error while resolving git ref: %v", err)
+ return nil, false, fmt.Errorf("error while resolving head git ref: %s for pull #%d. Error: %v", pr.Head.Ref, pr.Index, err)
}
headSHA = headCommit.SHA
}
@@ -534,7 +534,7 @@ func (g *GiteaDownloader) GetPullRequests(page, perPage int) ([]*base.PullReques
reactions, err := g.getIssueReactions(pr.Index)
if err != nil {
- return nil, false, fmt.Errorf("error while loading reactions: %v", err)
+ return nil, false, fmt.Errorf("error while loading reactions for pull #%d. Error: %v", pr.Index, err)
}
var assignees []string
diff --git a/modules/migrations/gitea_uploader.go b/modules/migrations/gitea_uploader.go
index cd1fd5cb8d..466c832754 100644
--- a/modules/migrations/gitea_uploader.go
+++ b/modules/migrations/gitea_uploader.go
@@ -28,6 +28,7 @@ import (
"code.gitea.io/gitea/modules/storage"
"code.gitea.io/gitea/modules/structs"
"code.gitea.io/gitea/modules/timeutil"
+ "code.gitea.io/gitea/services/pull"
gouuid "github.com/google/uuid"
)
@@ -524,6 +525,7 @@ func (g *GiteaLocalUploader) CreatePullRequests(prs ...*base.PullRequest) error
}
for _, pr := range gprs {
g.issues.Store(pr.Issue.Index, pr.Issue.ID)
+ pull.AddToTaskQueue(pr)
}
return nil
}