mirror of
https://github.com/go-gitea/gitea.git
synced 2026-10-26 06:16:56 +09:00
feat: Improve Gitea-compatible forge migrations, fix many migration bugs (#39424)
Supports migrating from Gitea-compatible forges like Forgejo and fixes many migration bugs. 1. Pre-release and `+gitea-` suffixed server versions no longer drop reviews, reactions and pagination. 2. Review states, dismissals, scoped and archived labels and merge bases are migrated. 3. Disabled units, external trackers, unavailable release assets, and GitLab confidential issues and internal notes are skipped. 4. Credentials are only sent to the source host, and `Retry-After` rate limits are waited out. 5. GitHub migrations of only issues or pull requests, basic auth clones and dismissed reviews work again. 6. The API returns 404 for releases of a disabled unit and shows migrated authors as mannequins, replacing the never populated `original_author` and `original_author_id` fields. Fixes: https://github.com/go-gitea/gitea/issues/19533 Fixes: https://github.com/go-gitea/gitea/issues/35885 Fixes: https://github.com/go-gitea/gitea/issues/18275 Fixes: https://github.com/go-gitea/gitea/issues/35069 Fixes: https://github.com/go-gitea/gitea/issues/17763 Fixes: https://github.com/go-gitea/gitea/issues/39548 Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
1 parent
7c91252be3
commit
fc49368845
94 files changed
+912
-417
No files matched your search
+12
-14
@@ -49,20 +49,18 @@ type RepositoryMeta struct {
|
||||
// Issue represents an issue in a repository
|
||||
// swagger:model
|
||||
type Issue struct {
|
||||
ID int64 `json:"id"`
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Index int64 `json:"number"`
|
||||
Poster *User `json:"user"`
|
||||
OriginalAuthor string `json:"original_author"`
|
||||
OriginalAuthorID int64 `json:"original_author_id"`
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
Ref string `json:"ref"`
|
||||
Attachments []*Attachment `json:"assets"`
|
||||
Labels []*Label `json:"labels"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
Projects []*Project `json:"projects"`
|
||||
ID int64 `json:"id"`
|
||||
URL string `json:"url"`
|
||||
HTMLURL string `json:"html_url"`
|
||||
Index int64 `json:"number"`
|
||||
Poster *User `json:"user"`
|
||||
Title string `json:"title"`
|
||||
Body string `json:"body"`
|
||||
Ref string `json:"ref"`
|
||||
Attachments []*Attachment `json:"assets"`
|
||||
Labels []*Label `json:"labels"`
|
||||
Milestone *Milestone `json:"milestone"`
|
||||
Projects []*Project `json:"projects"`
|
||||
// deprecated
|
||||
Assignee *User `json:"assignee"`
|
||||
Assignees []*User `json:"assignees"`
|
||||
|
||||
@@ -19,10 +19,6 @@ type Comment struct {
|
||||
IssueURL string `json:"issue_url"`
|
||||
// Poster is the user who posted the comment
|
||||
Poster *User `json:"user"`
|
||||
// OriginalAuthor is the original author name (for imported comments)
|
||||
OriginalAuthor string `json:"original_author"`
|
||||
// OriginalAuthorID is the original author ID (for imported comments)
|
||||
OriginalAuthorID int64 `json:"original_author_id"`
|
||||
// Body contains the comment text content
|
||||
Body string `json:"body"`
|
||||
// Attachments contains files attached to the comment
|
||||
|
||||
@@ -358,6 +358,7 @@ const (
|
||||
CodebaseService // 8 codebase service
|
||||
CodeCommitService // 9 codecommit service
|
||||
BitbucketServerService // 10 bitbucket server (data center) service
|
||||
ForgejoService // 11 forgejo service
|
||||
)
|
||||
|
||||
// Name represents the service type's name
|
||||
@@ -387,6 +388,8 @@ func (gt GitServiceType) Title() string {
|
||||
return "CodeCommit"
|
||||
case BitbucketServerService:
|
||||
return "Bitbucket Server"
|
||||
case ForgejoService:
|
||||
return "Forgejo"
|
||||
case PlainGitService:
|
||||
return "Git"
|
||||
}
|
||||
@@ -423,7 +426,7 @@ type MigrateRepoOptions struct {
|
||||
// required: true
|
||||
RepoName string `json:"repo_name" binding:"Required;AlphaDashDot;MaxSize(100)"`
|
||||
|
||||
// enum: ["git","github","gitea","gitlab","gogs","onedev","gitbucket","codebase","codecommit","bitbucketserver"]
|
||||
// enum: ["git","github","gitea","gitlab","gogs","onedev","gitbucket","codebase","codecommit","bitbucketserver","forgejo"]
|
||||
Service string `json:"service"`
|
||||
AuthUsername string `json:"auth_username"`
|
||||
AuthPassword string `json:"auth_password"`
|
||||
@@ -449,7 +452,7 @@ type MigrateRepoOptions struct {
|
||||
// TokenAuth represents whether a service type supports token-based auth
|
||||
func (gt GitServiceType) TokenAuth() bool {
|
||||
switch gt {
|
||||
case GithubService, GiteaService, GitlabService:
|
||||
case GithubService, GiteaService, GitlabService, ForgejoService:
|
||||
return true
|
||||
}
|
||||
return false
|
||||
@@ -461,6 +464,7 @@ var SupportedFullGitService = []GitServiceType{
|
||||
GithubService,
|
||||
GitlabService,
|
||||
GiteaService,
|
||||
ForgejoService,
|
||||
GogsService,
|
||||
OneDevService,
|
||||
GitBucketService,
|
||||
|
||||
Reference in new issue
Block a user