Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
李少辉-开发者
gitlab-foss
提交
fc548207
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 搜索 >>
提交
fc548207
编写于
9月 26, 2016
作者:
J
James Lopez
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
fix model order in import/export config and 1to1 relation issue. Added relevant specs.
上级
7b42ff63
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
54 addition
and
5 deletion
+54
-5
CHANGELOG
CHANGELOG
+1
-0
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+3
-3
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+7
-1
spec/lib/gitlab/import_export/project.json
spec/lib/gitlab/import_export/project.json
+37
-1
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
+6
-0
未找到文件。
CHANGELOG
浏览文件 @
fc548207
...
...
@@ -11,6 +11,7 @@ v 8.12.2 (unreleased)
- Fix snippets pagination
- Fix List-Unsubscribe header in emails
- Fix an issue with the "Commits" section of the cycle analytics summary. !6513
- Fix errors importing project feature and milestone models using GitLab project import
v 8.12.1
- Fix a memory leak in HTML::Pipeline::SanitizationFilter::WHITELIST
...
...
lib/gitlab/import_export/import_export.yml
浏览文件 @
fc548207
# Model relationships to be included in the project import/export
project_tree
:
-
:labels
-
milestones
:
-
:events
-
issues
:
-
:events
-
notes
:
...
...
@@ -39,9 +42,6 @@ project_tree:
-
protected_branches
:
-
:merge_access_levels
-
:push_access_levels
-
:labels
-
milestones
:
-
:events
-
:project_feature
# Only include the following attributes for the models specified.
...
...
lib/gitlab/import_export/project_tree_restorer.rb
浏览文件 @
fc548207
...
...
@@ -61,11 +61,17 @@ module Gitlab
def
restore_project
return
@project
unless
@tree_hash
project_params
=
@tree_hash
.
reject
{
|
_key
,
value
|
value
.
is_a?
(
Array
)
}
@project
.
update
(
project_params
)
@project
end
def
project_params
@tree_hash
.
reject
do
|
key
,
value
|
# return params that are not 1 to many or 1 to 1 relations
value
.
is_a?
(
Array
)
||
key
==
key
.
singularize
end
end
# Given a relation hash containing one or more models and its relationships,
# loops through each model and each object from a model type and
# and assigns its correspondent attributes hash from +tree_hash+
...
...
spec/lib/gitlab/import_export/project.json
浏览文件 @
fc548207
...
...
@@ -2231,6 +2231,31 @@
],
"milestones"
:
[
{
"id"
:
1
,
"title"
:
"test milestone"
,
"project_id"
:
8
,
"description"
:
"test milestone"
,
"due_date"
:
null
,
"created_at"
:
"2016-06-14T15:02:04.415Z"
,
"updated_at"
:
"2016-06-14T15:02:04.415Z"
,
"state"
:
"active"
,
"iid"
:
1
,
"events"
:
[
{
"id"
:
487
,
"target_type"
:
"Milestone"
,
"target_id"
:
1
,
"title"
:
null
,
"data"
:
null
,
"project_id"
:
46
,
"created_at"
:
"2016-06-14T15:02:04.418Z"
,
"updated_at"
:
"2016-06-14T15:02:04.418Z"
,
"action"
:
1
,
"author_id"
:
18
}
]
},
{
"id"
:
20
,
"title"
:
"v4.0"
,
...
...
@@ -7373,5 +7398,16 @@
}
]
}
]
],
"project_feature"
:
{
"builds_access_level"
:
0
,
"created_at"
:
"2014-12-26T09:26:45.000Z"
,
"id"
:
2
,
"issues_access_level"
:
0
,
"merge_requests_access_level"
:
20
,
"project_id"
:
4
,
"snippets_access_level"
:
20
,
"updated_at"
:
"2016-09-23T11:58:28.000Z"
,
"wiki_access_level"
:
20
}
}
\ No newline at end of file
spec/lib/gitlab/import_export/project_tree_restorer_spec.rb
浏览文件 @
fc548207
...
...
@@ -107,6 +107,12 @@ describe Gitlab::ImportExport::ProjectTreeRestorer, services: true do
expect
(
Label
.
first
.
label_links
.
first
.
target
).
not_to
be_nil
end
it
'has a project feature'
do
restored_project_json
expect
(
project
.
project_feature
).
not_to
be_nil
end
it
'restores the correct service'
do
restored_project_json
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录