BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
d3348474
Commit
d3348474
authored
Sep 03, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
some more refactoring
parent
4a9dcfdc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
17 deletions
+15
-17
project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+15
-17
No files found.
lib/gitlab/import_export/project_tree_restorer.rb
View file @
d3348474
...
...
@@ -60,7 +60,7 @@ module Gitlab
else
relation_key
=
relation
.
is_a?
(
Hash
)
?
relation
.
keys
.
first
:
relation
relation_hash_list
=
@tree_hash
[
relation_key
.
to_s
]
save_relation_hash
(
relation_hash_list
,
relation_key
,
@saved
)
save_relation_hash
(
relation_hash_list
,
relation_key
)
end
...
...
@@ -85,10 +85,6 @@ module Gitlab
relation_hash
=
create_relation
(
relation_key
,
relation_hash_batch
)
@saved
<<
restored_project
.
append_or_update_attribute
(
relation_key
,
relation_hash
)
@restored_project
=
nil
@project
=
nil
relation_hash
=
nil
relation_hash_batch
=
nil
@restored_project
=
Project
.
find_by_id
(
@project_id
)
end
...
...
@@ -127,27 +123,29 @@ module Gitlab
tree_array
=
[
tree_hash
[
relation_key
]].
flatten
while
relation_item
=
tree_array
.
shift
relation
.
values
.
flatten
.
each
do
|
sub_relation
|
# We just use author to get the user ID, do not attempt to create an instance.
next
if
sub_relation
==
:author
create_sub_relations
(
sub_relation
,
relation_item
,
false
)
if
sub_relation
.
is_a?
(
Hash
)
relation_hash
,
sub_relation
=
assign_relation_hash
(
relation_item
,
sub_relation
)
relation_item
[
sub_relation
.
to_s
]
=
create_relation
(
sub_relation
,
relation_hash
)
unless
relation_hash
.
blank?
end
process_sub_relation
(
relation
,
relation_item
)
if
save
save_relation_hash
([
relation_item
],
relation_key
)
tree_hash
[
relation_key
].
delete
(
relation_item
)
end
tree_hash
[
relation_key
].
delete
(
relation_item
)
if
save
relation_item
=
nil
end
tree_hash
.
delete
(
relation_key
)
if
save
end
def
process_sub_relation
(
relation
,
relation_item
)
relation
.
values
.
flatten
.
each
do
|
sub_relation
|
# We just use author to get the user ID, do not attempt to create an instance.
next
if
sub_relation
==
:author
create_sub_relations
(
sub_relation
,
relation_item
,
false
)
if
sub_relation
.
is_a?
(
Hash
)
relation_hash
,
sub_relation
=
assign_relation_hash
(
relation_item
,
sub_relation
)
relation_item
[
sub_relation
.
to_s
]
=
create_relation
(
sub_relation
,
relation_hash
)
unless
relation_hash
.
blank?
end
end
def
assign_relation_hash
(
relation_item
,
sub_relation
)
if
sub_relation
.
is_a?
(
Hash
)
relation_hash
=
relation_item
[
sub_relation
.
keys
.
first
.
to_s
]
...
...
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