Skip to content

GitLab Next

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
GitLab FOSS
GitLab FOSS
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
    • Iterations
  • Merge requests 1
    • Merge requests 1
  • Requirements
    • Requirements
    • List
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Code Review
    • Insights
    • Issue
    • Repository
    • Value Stream
  • Snippets
    • Snippets
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
Collapse sidebar
  • GitLab.org
  • GitLab FOSSGitLab FOSS
  • Merge requests
  • !20164

Merged
Created Jun 25, 2018 by Stan Hu@stanhuOwner9 of 10 tasks completed9/10 tasks

Add support for Bitbucket Server imports

  • Overview 110
  • Commits 160
  • Pipelines 119
  • 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
11.2
Milestone
11.2 (Past due)
Assign milestone
Time tracking
Source branch: sh-support-bitbucket-server-import