Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Jérome Perrin
gitlab-ce
Commits
8165e520
Commit
8165e520
authored
May 12, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add author on notes to export - so we can add to a note if project member is not found
parent
b2b7b38c
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+6
-2
lib/gitlab/import_export/import_export_reader.rb
lib/gitlab/import_export/import_export_reader.rb
+12
-0
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+7
-0
No files found.
lib/gitlab/import_export/import_export.yml
View file @
8165e520
# Model relationships to be included in the project import/export
# Model relationships to be included in the project import/export
project_tree
:
project_tree
:
-
issues
:
-
issues
:
-
:notes
-
notes
:
:author
-
:labels
-
:labels
-
:milestones
-
:milestones
-
:snippets
-
:snippets
...
@@ -10,8 +11,9 @@ project_tree:
...
@@ -10,8 +11,9 @@ project_tree:
-
project_members
:
-
project_members
:
-
:user
-
:user
-
merge_requests
:
-
merge_requests
:
-
notes
:
:author
-
:merge_request_diff
-
:merge_request_diff
-
:notes
-
ci_commits
:
-
ci_commits
:
-
:statuses
-
:statuses
...
@@ -31,6 +33,8 @@ included_attributes:
...
@@ -31,6 +33,8 @@ included_attributes:
-
:id
-
:id
-
:email
-
:email
-
:username
-
:username
author
:
-
:name
# Do not include the following attributes for the models specified.
# Do not include the following attributes for the models specified.
excluded_attributes
:
excluded_attributes
:
...
...
lib/gitlab/import_export/import_export_reader.rb
View file @
8165e520
...
@@ -37,10 +37,22 @@ module Gitlab
...
@@ -37,10 +37,22 @@ module Gitlab
@attributes_parser
.
parse
(
current_key
)
{
|
hash
|
@json_config_hash
[
current_key
]
||=
hash
}
@attributes_parser
.
parse
(
current_key
)
{
|
hash
|
@json_config_hash
[
current_key
]
||=
hash
}
handle_model_object
(
current_key
,
model_object
)
handle_model_object
(
current_key
,
model_object
)
process_sub_model
(
current_key
,
model_object
)
if
model_object
.
is_a?
(
Hash
)
end
end
@json_config_hash
@json_config_hash
end
end
def
process_sub_model
(
current_key
,
model_object
)
sub_model_json
=
build_json_config_hash
(
model_object
).
dup
@json_config_hash
.
slice!
(
current_key
)
if
@json_config_hash
[
current_key
]
&&
@json_config_hash
[
current_key
][
:include
]
@json_config_hash
[
current_key
][
:include
]
<<
sub_model_json
else
@json_config_hash
[
current_key
]
=
{
include:
sub_model_json
}
end
end
def
handle_model_object
(
current_key
,
model_object
)
def
handle_model_object
(
current_key
,
model_object
)
if
@json_config_hash
[
current_key
]
if
@json_config_hash
[
current_key
]
add_model_value
(
current_key
,
model_object
)
add_model_value
(
current_key
,
model_object
)
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
8165e520
...
@@ -65,6 +65,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -65,6 +65,10 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
expect
(
saved_project_json
[
'issues'
].
first
[
'notes'
]).
not_to
be_empty
expect
(
saved_project_json
[
'issues'
].
first
[
'notes'
]).
not_to
be_empty
end
end
it
'has author on issue comments'
do
expect
(
saved_project_json
[
'issues'
].
first
[
'notes'
].
first
[
'author'
]).
not_to
be_empty
end
it
'has project members'
do
it
'has project members'
do
expect
(
saved_project_json
[
'project_members'
]).
not_to
be_empty
expect
(
saved_project_json
[
'project_members'
]).
not_to
be_empty
end
end
...
@@ -77,6 +81,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
...
@@ -77,6 +81,9 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'notes'
]).
not_to
be_empty
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'notes'
]).
not_to
be_empty
end
end
it
'has author on merge requests comments'
do
expect
(
saved_project_json
[
'merge_requests'
].
first
[
'notes'
].
first
[
'author'
]).
not_to
be_empty
end
it
'has commit statuses'
do
it
'has commit statuses'
do
expect
(
saved_project_json
[
'ci_commits'
].
first
[
'statuses'
]).
not_to
be_empty
expect
(
saved_project_json
[
'ci_commits'
].
first
[
'statuses'
]).
not_to
be_empty
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment