Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
973f2dd9
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,体验更适合开发者的 AI 搜索 >>
提交
973f2dd9
编写于
8月 29, 2019
作者:
M
Michael Leopard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Reversing pipeline order on import
Updating tree restorer and saver tests
上级
a9cd5d2a
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
41 addition
and
15 deletion
+41
-15
changelogs/unreleased/60121-pipelines-in-reverse-order-after-import.yml
...eleased/60121-pipelines-in-reverse-order-after-import.yml
+5
-0
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+11
-0
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+7
-0
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+18
-15
未找到文件。
changelogs/unreleased/60121-pipelines-in-reverse-order-after-import.yml
0 → 100644
浏览文件 @
973f2dd9
---
title
:
Reverse Pipeline Order On Import
merge_request
:
32388
author
:
type
:
fixed
lib/gitlab/import_export/project_tree_restorer.rb
浏览文件 @
973f2dd9
...
...
@@ -28,6 +28,8 @@ module Gitlab
RelationRenameService
.
rename
(
@tree_hash
)
correct_pipeline_order
ActiveRecord
::
Base
.
uncached
do
ActiveRecord
::
Base
.
no_touching
do
create_relations
...
...
@@ -235,6 +237,15 @@ module Gitlab
def
nil_iid_pipeline?
(
relation_key
,
relation_item
)
relation_key
==
'ci_pipelines'
&&
relation_item
[
'iid'
].
nil?
end
def
correct_pipeline_order
if
@tree_hash
[
'ci_pipelines'
].
present?
pipelines
=
@tree_hash
[
"ci_pipelines"
]
if
pipelines
.
first
[
"created_at"
]
>
pipelines
.
last
[
"created_at"
]
@tree_hash
[
"ci_pipelines"
].
sort_by!
{
|
pipelines
|
pipelines
[
'created_at'
]
}
end
end
end
end
end
end
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
浏览文件 @
973f2dd9
...
...
@@ -62,6 +62,13 @@ describe Gitlab::ImportExport::ProjectTreeRestorer do
expect
(
Milestone
.
find_by_description
(
'test milestone'
).
issues
.
count
).
to
eq
(
2
)
end
it
'has ci pipeline builds in reverse chronological order'
do
first_build
=
@project
.
ci_pipelines
.
first
last_build
=
@project
.
ci_pipelines
.
last
expect
(
first_build
[
"created_at"
]).
to
be
<
last_build
[
"created_at"
]
end
context
'when importing a project with cached_markdown_version and note_html'
do
context
'for an Issue'
do
it
'does not import note_html'
do
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
浏览文件 @
973f2dd9
...
...
@@ -196,10 +196,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
it
'has pipeline builds'
do
builds_count
=
saved_project_json
.
dig
(
'ci_pipelines'
,
0
,
'stages'
,
0
,
'statuses'
)
.
count
{
|
hash
|
hash
[
'type'
]
==
'Ci::Build'
}
.
dig
(
'ci_pipelines'
).
length
expect
(
builds_count
).
to
eq
(
1
)
expect
(
builds_count
).
to
eq
(
3
)
end
it
'has no when YML attributes but only the DB column'
do
...
...
@@ -359,18 +358,22 @@ describe Gitlab::ImportExport::ProjectTreeSaver do
milestone
=
create
(
:milestone
,
project:
project
)
merge_request
=
create
(
:merge_request
,
source_project:
project
,
milestone:
milestone
)
ci_build
=
create
(
:ci_build
,
project:
project
,
when:
nil
)
ci_build
.
pipeline
.
update
(
project:
project
)
create
(
:commit_status
,
project:
project
,
pipeline:
ci_build
.
pipeline
)
create
(
:milestone
,
project:
project
)
create
(
:discussion_note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
create
(
:note_on_commit
,
author:
user
,
project:
project
,
commit_id:
ci_build
.
pipeline
.
sha
)
pipelines
=
[]
3
.
times
do
|
i
|
pipelines
.
push
(
create
(
:ci_empty_pipeline
,
project:
project
,
sha:
project
.
commit
.
sha
,
ref:
'master'
))
ci_build
=
create
(
:ci_build
,
project:
project
,
when:
nil
,
pipeline:
pipelines
[
i
])
ci_build
.
pipeline
.
update
(
project:
project
)
create
(
:commit_status
,
project:
project
,
pipeline:
ci_build
.
pipeline
)
create
(
:milestone
,
project:
project
)
create
(
:discussion_note
,
noteable:
issue
,
project:
project
)
create
(
:note
,
noteable:
merge_request
,
project:
project
)
create
(
:note
,
noteable:
snippet
,
project:
project
)
create
(
:note_on_commit
,
author:
user
,
project:
project
,
commit_id:
ci_build
.
pipeline
.
sha
)
end
create
(
:resource_label_event
,
label:
project_label
,
issue:
issue
)
create
(
:resource_label_event
,
label:
group_label
,
merge_request:
merge_request
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录