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
Jérome Perrin
gitlab-ce
Commits
ec394d49
Commit
ec394d49
authored
Jun 22, 2018
by
James Lopez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add some more comments
parent
d8252efe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
5 deletions
+10
-5
lib/gitlab/import_export/group_project_object_builder.rb
lib/gitlab/import_export/group_project_object_builder.rb
+7
-5
lib/gitlab/import_export/project_tree_restorer.rb
lib/gitlab/import_export/project_tree_restorer.rb
+3
-0
No files found.
lib/gitlab/import_export/group_project_object_builder.rb
View file @
ec394d49
module
Gitlab
module
ImportExport
# Given a class, it finds or creates a new object
# (initializes in the case of Label) at group or project level
# If it does not exist in the group, it creates it at project level
# (initializes in the case of Label) at group or project level
.
# If it does not exist in the group, it creates it at project level
.
#
#
For e
xample:
# `GroupProjectObjectBuilder.build(Label, label_attributes)`
# finds or initializes a label with the given attributes.
#
E
xample:
#
`GroupProjectObjectBuilder.build(Label, label_attributes)`
#
finds or initializes a label with the given attributes.
#
# It also adds some logic around Group Labels/Milestones for edge cases.
class
GroupProjectObjectBuilder
...
...
@@ -88,6 +88,8 @@ module Gitlab
# - Importing into a user namespace project with exported group milestones
# where the IID of the Group milestone could conflict with a project one.
def
claim_iid
# The milestone has to be a group milestone, as it's the only case where
# we set the IID as the maximum. The rest of them are fixed.
group_milestone
=
@project
.
milestones
.
find_by
(
iid:
@attributes
[
'iid'
])
group_milestone
.
update!
(
iid:
max_milestone_iid
+
1
)
if
group_milestone
...
...
lib/gitlab/import_export/project_tree_restorer.rb
View file @
ec394d49
...
...
@@ -78,6 +78,9 @@ module Gitlab
@restored_project
=
Project
.
find
(
@project_id
)
end
# Remove project models that became group models as we found them at group level.
# This no longer required saving them at the root project level.
# For example, in the case of an existing group label that matched the title.
def
remove_group_models
(
relation_hash
)
relation_hash
.
reject!
do
|
value
|
value
.
respond_to?
(
:group_id
)
&&
value
.
group_id
&&
GROUP_MODELS
.
include?
(
value
.
class
)
...
...
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