Add support for Bitbucket Server imports
Currently this does the following:
- Asks user for the server, username, and password/PAT to login to Bitbucket
- Lists the current repositories on Bitbucket server
- Clones the repository
- Imports pull requests and comments (assuming the commit SHAs exist)
- Add a reconfigure step in case password/personal access token is wrong
Make it possible to handle personal access tokens that have
/. Right now URL validation is rejecting these.
For pull requests that are missing commits in the cloned repo, create temporary GitLab branches on Bitbucket Server using API (
/rest/api/1.0/projects/project_key/repos/repoSlug/branches). Resync the repository to get these "unreachable" commits. Question: Should this be optional?
- Handle errors when password is incorrect/hostname is bad
- Handle errors when API response is bad
- Add comments when pull request comments are outside of the GitLab diff
- Add tests
- Add documentation
- GitLab doesn't allow comments on arbitrary lines of code, so we lose any comments outside of the diff. For now, we'll just insert these as comments in the merge request with file details.
- Bitbucket Server allows multiple levels of threading. GitLab import will collapse this into one discussion and quote part of the original comment.
- Attachments in Markdown are currently not imported.
- Task lists are not imported.
- Emoji reactions are not imported (I see no API for this).
Comments must be retrieved from the activities endpoint: https://community.atlassian.com/t5/Bitbucket-questions/Retrieving-comments-from-Bitbucket-server-via-REST-API/qaq-p/282253
It looks like Bitbucket Server enables the
allowReachableSHA1InWantflag in git. We may be able to fetch commits relating to pull requests that have deleted branches. UPDATE: Nope, this doesn't work for our use case. We'll need to create a temporary branch using the Bitbucket Server API.