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
025a2688
Commit
025a2688
authored
Sep 02, 2017
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more refactoring
parent
690b9865
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+5
-3
No files found.
lib/gitlab/import_export/project_tree_restorer.rb
View file @
025a2688
...
@@ -80,6 +80,7 @@ module Gitlab
...
@@ -80,6 +80,7 @@ module Gitlab
def
save_relation_hash
(
relation_hash_batch
,
relation_key
)
def
save_relation_hash
(
relation_hash_batch
,
relation_key
)
relation_hash
=
create_relation
(
relation_key
,
relation_hash_batch
)
relation_hash
=
create_relation
(
relation_key
,
relation_hash_batch
)
@saved
<<
restored_project
.
append_or_update_attribute
(
relation_key
,
relation_hash
)
@saved
<<
restored_project
.
append_or_update_attribute
(
relation_key
,
relation_hash
)
@restored_project
=
nil
@restored_project
=
nil
@project
=
nil
@project
=
nil
...
@@ -115,7 +116,8 @@ module Gitlab
...
@@ -115,7 +116,8 @@ module Gitlab
# issue, finds any subrelations such as notes, creates them and assign them back to the hash
# issue, finds any subrelations such as notes, creates them and assign them back to the hash
#
#
# Recursively calls this method if the sub-relation is a hash containing more sub-relations
# Recursively calls this method if the sub-relation is a hash containing more sub-relations
def
create_sub_relations
(
relation
,
tree_hash
)
def
create_sub_relations
(
relation
,
tree_hash
,
save
=
true
)
tree_hash
=
tree_hash
.
dup
relation_key
=
relation
.
keys
.
first
.
to_s
relation_key
=
relation
.
keys
.
first
.
to_s
return
if
tree_hash
[
relation_key
].
blank?
return
if
tree_hash
[
relation_key
].
blank?
...
@@ -124,13 +126,13 @@ module Gitlab
...
@@ -124,13 +126,13 @@ module Gitlab
# We just use author to get the user ID, do not attempt to create an instance.
# We just use author to get the user ID, do not attempt to create an instance.
next
if
sub_relation
==
:author
next
if
sub_relation
==
:author
create_sub_relations
(
sub_relation
,
relation_item
)
if
sub_relation
.
is_a?
(
Hash
)
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_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?
relation_item
[
sub_relation
.
to_s
]
=
create_relation
(
sub_relation
,
relation_hash
)
unless
relation_hash
.
blank?
end
end
save_relation_hash
(
relation_item
,
relation_key
)
save_relation_hash
(
[
relation_item
],
relation_key
)
if
save
end
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