Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
69fe32a5
G
gitlab-foss
项目概览
李少辉-开发者
/
gitlab-foss
通知
15
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
G
gitlab-foss
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
69fe32a5
编写于
7月 20, 2018
作者:
S
Stan Hu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Disable recovery of missing SHAs by default
上级
c73db33f
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
10 addition
and
3 deletion
+10
-3
lib/gitlab/bitbucket_server_import/importer.rb
lib/gitlab/bitbucket_server_import/importer.rb
+9
-2
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
+1
-1
未找到文件。
lib/gitlab/bitbucket_server_import/importer.rb
浏览文件 @
69fe32a5
...
@@ -2,6 +2,7 @@ module Gitlab
...
@@ -2,6 +2,7 @@ module Gitlab
module
BitbucketServerImport
module
BitbucketServerImport
class
Importer
class
Importer
include
Gitlab
::
ShellAdapter
include
Gitlab
::
ShellAdapter
attr_reader
:recover_missing_commits
attr_reader
:project
,
:project_key
,
:repository_slug
,
:client
,
:errors
,
:users
attr_reader
:project
,
:project_key
,
:repository_slug
,
:client
,
:errors
,
:users
REMOTE_NAME
=
'bitbucket_server'
.
freeze
REMOTE_NAME
=
'bitbucket_server'
.
freeze
...
@@ -17,8 +18,14 @@ module Gitlab
...
@@ -17,8 +18,14 @@ module Gitlab
[
:heads
,
:tags
,
'+refs/pull-requests/*/to:refs/merge-requests/*/head'
]
[
:heads
,
:tags
,
'+refs/pull-requests/*/to:refs/merge-requests/*/head'
]
end
end
def
initialize
(
project
)
# Unlike GitHub, you can't grab the commit SHAs for pull requests that
# have been closed but not merged even though Bitbucket has these
# commits internally. We can recover these pull requests by creating a
# branch with the Bitbucket REST API, but by default we turn this
# behavior off.
def
initialize
(
project
,
recover_missing_commits:
false
)
@project
=
project
@project
=
project
@recover_missing_commits
=
recover_missing_commits
@project_key
=
project
.
import_data
.
data
[
'project_key'
]
@project_key
=
project
.
import_data
.
data
[
'project_key'
]
@repository_slug
=
project
.
import_data
.
data
[
'repo_slug'
]
@repository_slug
=
project
.
import_data
.
data
[
'repo_slug'
]
@client
=
BitbucketServer
::
Client
.
new
(
project
.
import_data
.
credentials
)
@client
=
BitbucketServer
::
Client
.
new
(
project
.
import_data
.
credentials
)
...
@@ -141,7 +148,7 @@ module Gitlab
...
@@ -141,7 +148,7 @@ module Gitlab
# may take a number of network round-trips. Do this in batches so that we can
# may take a number of network round-trips. Do this in batches so that we can
# avoid doing a git fetch for every new branch.
# avoid doing a git fetch for every new branch.
pull_requests
.
each_slice
(
BATCH_SIZE
)
do
|
batch
|
pull_requests
.
each_slice
(
BATCH_SIZE
)
do
|
batch
|
restore_branches
(
batch
)
restore_branches
(
batch
)
if
recover_missing_commits
batch
.
each
do
|
pull_request
|
batch
.
each
do
|
pull_request
|
begin
begin
...
...
spec/lib/gitlab/bitbucket_server_import/importer_spec.rb
浏览文件 @
69fe32a5
...
@@ -9,7 +9,7 @@ describe Gitlab::BitbucketServerImport::Importer do
...
@@ -9,7 +9,7 @@ describe Gitlab::BitbucketServerImport::Importer do
let
(
:repo_slug
)
{
'rouge'
}
let
(
:repo_slug
)
{
'rouge'
}
let
(
:sample
)
{
RepoHelpers
.
sample_compare
}
let
(
:sample
)
{
RepoHelpers
.
sample_compare
}
subject
{
described_class
.
new
(
project
)
}
subject
{
described_class
.
new
(
project
,
recover_missing_commits:
true
)
}
before
do
before
do
data
=
project
.
create_or_update_import_data
(
data
=
project
.
create_or_update_import_data
(
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录