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
Boxiang Sun
gitlab-ce
Commits
de6c44e9
Commit
de6c44e9
authored
Apr 07, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
using new config
parent
acfa0b69
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
24 deletions
+19
-24
app/services/projects/import_export.rb
app/services/projects/import_export.rb
+1
-17
app/services/projects/import_export/import_export.yml
app/services/projects/import_export/import_export.yml
+5
-1
app/services/projects/import_export/import_export_reader.rb
app/services/projects/import_export/import_export_reader.rb
+12
-5
app/services/projects/import_export/project_tree_saver.rb
app/services/projects/import_export/project_tree_saver.rb
+1
-1
No files found.
app/services/projects/import_export.rb
View file @
de6c44e9
...
...
@@ -11,27 +11,11 @@ module Projects
end
def
project_tree
%i(issues labels milestones releases events)
+
[
snippets
,
members
,
merge_requests
,
commit_statuses
]
Projects
::
ImportExport
::
ImportExportReader
.
project_tree
end
private
def
snippets
{
snippets:
{
except: :expired_at
}
}
end
def
merge_requests
{
merge_requests:
{
include: :merge_request_diff
}
}
end
def
commit_statuses
{
commit_statuses:
{
include: :commit
}
}
end
def
members
{
project_members:
{
include:
[
user:
{
only:
[
:id
,
:email
,
:username
]
}]
}
}
end
def
storage_path
File
.
join
(
Settings
.
shared
[
'path'
],
'tmp/project_exports'
)
end
...
...
app/services/projects/import_export/import_export.yml
View file @
de6c44e9
...
...
@@ -29,3 +29,7 @@
- :id
- :email
- :username
:attributes_except:
:snippets:
- :expired_at
\ No newline at end of file
app/services/projects/import_export/import_export_reader.rb
View file @
de6c44e9
...
...
@@ -26,7 +26,14 @@ module Projects
end
def
build_hash
(
array
)
array
.
map
{
|
el
|
el
.
is_a?
(
Hash
)
?
process_include
(
el
)
:
el
}
array
.
map
do
|
el
|
if
el
.
is_a?
(
Hash
)
process_include
(
el
)
else
only_except_hash
=
check_only_and_except
(
el
)
only_except_hash
.
empty?
?
el
:
{
el
=>
only_except_hash
}
end
end
end
def
process_include
(
hash
,
included_classes_hash
=
{})
...
...
@@ -44,8 +51,8 @@ module Projects
def
process_current_class
(
hash
,
included_classes_hash
,
value
)
value
=
value
.
is_a?
(
Hash
)
?
process_include
(
hash
,
included_classes_hash
)
:
value
current_key
=
hash
.
keys
.
first
current_key_only
=
check_only_and_except
(
current_key
)
included_classes_hash
[
current_key
]
||=
current_key_only
unless
current_key_only
.
empty?
only_except_hash
=
check_only_and_except
(
current_key
)
included_classes_hash
[
current_key
]
||=
only_except_hash
unless
only_except_hash
.
empty?
return
current_key
,
value
end
...
...
@@ -56,8 +63,8 @@ module Projects
end
def
add_class
(
current_key
,
included_classes_hash
,
value
)
check_only
_hash
=
check_only_and_except
(
value
)
value
=
{
value
=>
check_only_hash
}
unless
check_only
_hash
.
empty?
only_except
_hash
=
check_only_and_except
(
value
)
value
=
{
value
=>
only_except_hash
}
unless
only_except
_hash
.
empty?
old_values
=
included_classes_hash
[
current_key
][
:include
]
included_classes_hash
[
current_key
][
:include
]
=
([
old_values
]
+
[
value
]).
compact
.
flatten
end
...
...
app/services/projects/import_export/project_tree_saver.rb
View file @
de6c44e9
...
...
@@ -32,7 +32,7 @@ module Projects
def
project_json_tree
# TODO confirm children, also add subchildren (i.e comments)
# TODO confirm atts for children
@project
.
to_json
(
only:
ImportExport
.
project_atts
,
include:
ImportExport
.
project_tree
)
@project
.
to_json
(
Projects
::
ImportExport
.
project_tree
)
end
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