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
Tatuya Kamada
gitlab-ce
Commits
a5f04ad4
Commit
a5f04ad4
authored
May 18, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed CI commits on export
parent
301d64b8
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
6 deletions
+22
-6
lib/gitlab/import_export/attributes_finder.rb
lib/gitlab/import_export/attributes_finder.rb
+8
-2
lib/gitlab/import_export/import_export.yml
lib/gitlab/import_export/import_export.yml
+5
-1
lib/gitlab/import_export/import_export_reader.rb
lib/gitlab/import_export/import_export_reader.rb
+2
-1
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
+7
-2
No files found.
lib/gitlab/import_export/attributes_finder.rb
View file @
a5f04ad4
...
...
@@ -2,9 +2,10 @@ module Gitlab
module
ImportExport
class
AttributesFinder
def
initialize
(
included_attributes
:,
excluded_attributes
:)
def
initialize
(
included_attributes
:,
excluded_attributes
:
,
methods
:
)
@included_attributes
=
included_attributes
||
{}
@excluded_attributes
=
excluded_attributes
||
{}
@methods
=
methods
||
{}
end
def
find
(
model_object
)
...
...
@@ -27,10 +28,15 @@ module Gitlab
@excluded_attributes
[
key
].
nil?
?
{}
:
{
except:
@excluded_attributes
[
key
]
}
end
def
find_method
(
value
)
key
=
key_from_hash
(
value
)
@methods
[
key
].
nil?
?
{}
:
{
methods:
@methods
[
key
]
}
end
private
def
find_attributes_only
(
value
)
find_included
(
value
).
merge
(
find_excluded
(
value
))
find_included
(
value
).
merge
(
find_excluded
(
value
))
.
merge
(
find_method
(
value
))
end
def
key_from_hash
(
value
)
...
...
lib/gitlab/import_export/import_export.yml
View file @
a5f04ad4
...
...
@@ -45,4 +45,8 @@ included_attributes:
# Do not include the following attributes for the models specified.
excluded_attributes
:
snippets
:
-
:expired_at
\ No newline at end of file
-
:expired_at
methods
:
statuses
:
-
:type
\ No newline at end of file
lib/gitlab/import_export/import_export_reader.rb
View file @
a5f04ad4
...
...
@@ -7,7 +7,8 @@ module Gitlab
config_hash
=
YAML
.
load_file
(
config
).
deep_symbolize_keys
@tree
=
config_hash
[
:project_tree
]
@attributes_parser
=
Gitlab
::
ImportExport
::
AttributesFinder
.
new
(
included_attributes:
config_hash
[
:included_attributes
],
excluded_attributes:
config_hash
[
:excluded_attributes
])
excluded_attributes:
config_hash
[
:excluded_attributes
],
methods:
config_hash
[
:methods
])
end
def
project_tree
...
...
spec/lib/gitlab/import_export/project_tree_saver_spec.rb
View file @
a5f04ad4
...
...
@@ -84,10 +84,15 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
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
expect
(
saved_project_json
[
'ci_commits'
].
first
[
'statuses'
]).
not_to
be_empty
end
it
'has CI builds'
do
expect
(
saved_project_json
[
'ci_commits'
].
first
[
'statuses'
].
first
[
'type'
]).
to
eq
(
'Ci::Build'
)
end
it
'has ci commits'
do
expect
(
saved_project_json
[
'ci_commits'
]).
not_to
be_empty
end
...
...
@@ -99,7 +104,6 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
merge_request
=
create
(
:merge_request
)
label
=
create
(
:label
)
snippet
=
create
(
:project_snippet
)
commit_status
=
create
(
:commit_status
)
release
=
create
(
:release
)
project
=
create
(
:project
,
...
...
@@ -111,7 +115,8 @@ describe Gitlab::ImportExport::ProjectTreeSaver, services: true do
releases:
[
release
]
)
create
(
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
,
statuses:
[
commit_status
])
ci_commit
=
create
(
:ci_commit
,
project:
project
,
sha:
merge_request
.
last_commit
.
id
,
ref:
merge_request
.
source_branch
)
create
(
:ci_build
,
commit:
ci_commit
)
create
(
:milestone
,
project:
project
)
create
(
:note
,
noteable:
issue
)
create
(
:note
,
noteable:
merge_request
)
...
...
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