应用场景:


The Bitbucket importer 可以导入:

- Repository 描述 (GitLab 11.2+)
- Git repository 数据 (GitLab 11.2+)
- Pull requests (GitLab 11.2+)
- Pull request comments (GitLab 11.2+)

导入过程中, repository的公开性会被保留。如果一个仓库在bitbucke上是私有的,在Gitlab上也会生成为私有的。

分步指南

1. 登录GitLab, 访问你的 dashboard.
2. 点击**新建项目**.
3. 点击 “Bitbucket Server” 按钮.如果按钮不存在, 在 **Admin > Application Settings > Visibility and access controls > Import sources** 下开启.



(https://docs.gitlab.com/ee/user/project/import/img/import_projects_from_new_project_page.png)

4.输入Bitbucket密码 .

(https://docs.gitlab.com/ee/user/project/import/img/bitbucket_server_import_credentials.png)

5. 选择要导入的项目 或者  **Import all projects**.  也可以通过名字过滤项目,或者选择namespace, namespace下的项目全部导入。


(https://docs.gitlab.com/ee/user/project/import/img/bitbucket_server_import_select_project_v12_3.png)



限制

- Gitlab不允许任意的按行评论,所以Bitbucket中超出范围的评论就会变成Merge Request的评论。
- Bitbucket允许多级评论(盖楼),Gitlab导入成一级评论,原始评论被变成一个引用。
- 拒绝的的Pull Request有不可达的提交的话,Gitlab importer不能生成diff, 这种pull request导入的变化成为空。
- Markdown中的附件没有被导入
- 任务列表不被导入
- Emoji Reaction没有被导入。
- 项目过滤器不支持fuzzy search(只支持starts with 或者 full match string)

工作原理


## **How it works**

The Bitbucket Server importer works as follows:

1. The user is prompted to enter the URL, username, and password (or personal access token) to log in to Bitbucket. These credentials are preserved only as long as the importer is running.
2. The importer attempts to list all the current repositories on the Bitbucket Server.
3. Upon selection, the importer clones the repository and import pull requests and comments.

### **User assignment**

When issues/pull requests are being imported, the Bitbucket importer tries to find the author’s email address with a confirmed email address in the GitLab user database. If no such user is available, the project creator is set as the author. The importer appends a note in the comment to mark the original creator.

The importer creates any new namespaces (groups) if they don’t exist or in the case the namespace is taken, the repository is imported under the user’s namespace that started the import process.

### **User assignment by username**

Version history

This feature might not be available to you. Check the **version history** note above for details.

If you’ve enabled this feature, the importer tries to find a user in the GitLab user database with the author’s:

- `username`
- `slug`
- `displayName`

If the user is not found by any of these properties, the search falls back to the author’s `email` address.

Alternatively, if there is also no email address, the project creator is set as the author.

### **Enable or disable User assignment by username**

User assignment by username is under development and not ready for production use. It is deployed behind a feature flag that is **disabled by default**. [GitLab administrators with access to the GitLab Rails console](https://docs.gitlab.com/ee/administration/feature_flags.html) can enable it.

To enable it:

`Feature.enable(:bitbucket_server_user_mapping_by_username)`

To disable it:

`Feature.disable(:bitbucket_server_user_mapping_by_username)`



相关的文章

Error rendering macro 'contentbylabel'

parameters should not be empty