feat(migrations): add migration from Bitbucket Server (Data Center) (#39913)

Add migration from Bitbucket Server (Data Center). It has no issues,
wiki, milestones or releases, so those are not offered.

Migrated: git data with tags and LFS, and pull requests with state,
draft flag, merge commit/base, comments, approvals and inline code
comments including resolved threads. Multi-line ranges become a `Lines
a-b:` text prefix, as Gitea anchors code comments to one line. Auth is
an HTTP access token (personal, project or repository) or
username/password; 429 responses are retried.

Changes outside the downloader:
- `ReviewComment.Resolved`, applied by the uploader.
- The uploader creates a fork PR's head branch from its head commit when
already in the repository, instead of fetching the fork (Bitbucket keeps
it in `refs/pull-requests/<id>/from`; private forks need credentials).

Tested with unit tests, responses recorded from Bitbucket 10.5.1, and an
end-to-end migration. Independent of
https://github.com/go-gitea/gitea/pull/38607 (Bitbucket Cloud); the
service type enum value needs adjusting for whichever lands second.

---------

Co-authored-by: bircni <bircni@icloud.com>
This commit is contained in:
Lunny Xiaoandbircni authored and GitHub committed 2026-10-23 19:25:29 +00:00
1 parent 8cd7721deb
commit a2da5cd7b5
25 files changed
+1575 -45

No files matched your search

+4
View File
@@ -1122,6 +1122,10 @@
"repo.migrate.onedev.description": "Migrate data from code.onedev.io or other OneDev instances.",
"repo.migrate.codebase.description": "Migrate data from codebasehq.com.",
"repo.migrate.gitbucket.description": "Migrate data from GitBucket instances.",
"repo.migrate.bitbucketserver.description": "Migrate data from Bitbucket Data Center or Server instances.",
"repo.migrate.bitbucketserver.variant": "Data Center / Server",
"repo.migrate.hosting": "Hosting",
"repo.migrate.bitbucketserver.token_desc": "HTTP access token. If set, it is used instead of the password above. The username defaults to the owner of the token.",
"repo.migrate.codecommit.description": "Migrate data from AWS CodeCommit.",
"repo.migrate.codecommit.aws_access_key_id": "AWS Access Key ID",
"repo.migrate.codecommit.aws_secret_access_key": "AWS Secret Access Key",