Skip to content

GitLab Next

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • GitLab FOSS GitLab FOSS
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Package Registry
    • Container Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Metrics
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • Code review
    • Insights
    • Issue
    • Repository
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar

GitLab 15.0 has launched! Please visit Breaking changes in 15.0 and 15.0 Removals to see which breaking changes may impact your workflow.

  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !20164

Add support for Bitbucket Server imports

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Stan Hu requested to merge sh-support-bitbucket-server-import into master Jun 25, 2018
  • Overview 110
  • Commits 160
  • Pipelines 99
  • Changes 40

Currently this does the following:

  1. Asks user for the server, username, and password/PAT to login to Bitbucket
  2. Lists the current repositories on Bitbucket server
  3. Clones the repository
  4. Imports pull requests and comments (assuming the commit SHAs exist)

To do:

  1. Add a reconfigure step in case password/personal access token is wrong
  2. Make it possible to handle personal access tokens that have /. Right now URL validation is rejecting these.
  3. 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?
  4. Handle errors when password is incorrect/hostname is bad
  5. Handle errors when API response is bad
  6. Add comments when pull request comments are outside of the GitLab diff
  7. Add tests
  8. Add documentation
  9. Test:
    • Pagination

Screenshots

image

image

image

Limitations:

  1. 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.
  2. Bitbucket Server allows multiple levels of threading. GitLab import will collapse this into one discussion and quote part of the original comment.
  3. Attachments in Markdown are currently not imported.
  4. Task lists are not imported.
  5. Emoji reactions are not imported (I see no API for this).

Update:

  1. 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

  2. It looks like Bitbucket Server enables the allowReachableSHA1InWant flag 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.

Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/25393

Edited Aug 03, 2018 by Stan Hu
Assignee
Assign to
Reviewer
Request review from
Time tracking
Source branch: sh-support-bitbucket-server-import