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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
0d8a97dc
Commit
0d8a97dc
authored
Apr 12, 2016
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more fixes to import projects
parent
c94c0dc0
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
445 additions
and
5 deletions
+445
-5
app/services/projects/import_export/project_tree_restorer.rb
app/services/projects/import_export/project_tree_restorer.rb
+11
-2
app/services/projects/import_export/relation_factory.rb
app/services/projects/import_export/relation_factory.rb
+2
-2
fixtures/import_export/project.json
fixtures/import_export/project.json
+432
-1
No files found.
app/services/projects/import_export/project_tree_restorer.rb
View file @
0d8a97dc
...
...
@@ -58,12 +58,21 @@ module Projects
relation
.
values
.
flatten
.
each
do
|
sub_relation
|
relation_hash
=
relation_item
[
sub_relation
.
to_s
]
next
if
relation_hash
.
blank?
sub_relation_object
=
relation_from_factory
(
sub_relation
,
relation_hash
)
relation_item
[
sub_relation
.
to_s
]
=
sub_relation_object
process_sub_relation
(
relation_hash
,
relation_item
,
sub_relation
)
end
end
end
def
process_sub_relation
(
relation_hash
,
relation_item
,
sub_relation
)
sub_relation_object
=
nil
if
relation_hash
.
is_a?
(
Array
)
sub_relation_object
=
create_relation
(
sub_relation
,
relation_hash
)
else
sub_relation_object
=
relation_from_factory
(
sub_relation
,
relation_hash
)
end
relation_item
[
sub_relation
.
to_s
]
=
sub_relation_object
end
def
create_relation
(
relation
,
relation_hash_list
)
[
relation_hash_list
].
flatten
.
map
do
|
relation_hash
|
relation_from_factory
(
relation
,
relation_hash
)
...
...
app/services/projects/import_export/relation_factory.rb
View file @
0d8a97dc
...
...
@@ -48,8 +48,8 @@ module Projects
def
parse_relation
(
relation_hash
,
relation_sym
)
klass
=
relation_class
(
relation_sym
)
relation_hash
.
delete
(
'id'
)
#screw IDs for now
relation_hash
.
delete
(
'project_id'
)
unless
klass
.
column_names
.
include?
(
:project_id
)
relation_hash
.
delete
(
'id'
)
relation_hash
.
delete
(
'project_id'
)
unless
klass
.
column_names
.
include?
(
'project_id'
)
klass
end
end
...
...
fixtures/import_export/project.json
View file @
0d8a97dc
This diff is collapsed.
Click to expand it.
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