diff options
author | James Lopez <james@jameslopez.es> | 2018-06-22 11:27:52 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2018-06-22 11:27:52 +0200 |
commit | ec394d4908c339a54417a5ad89f3ed0504c1b123 (patch) | |
tree | ac47fa7f252db7ad493cb457c7d72a711a0ea2b4 /lib | |
parent | d8252efea9c0b8ad18275318e0af762f3b5ba59b (diff) | |
download | gitlab-ce-ec394d4908c339a54417a5ad89f3ed0504c1b123.tar.gz |
add some more comments
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/import_export/group_project_object_builder.rb | 12 | ||||
-rw-r--r-- | lib/gitlab/import_export/project_tree_restorer.rb | 3 |
2 files changed, 10 insertions, 5 deletions
diff --git a/lib/gitlab/import_export/group_project_object_builder.rb b/lib/gitlab/import_export/group_project_object_builder.rb index c41d68e7aab..829fe6098ee 100644 --- a/lib/gitlab/import_export/group_project_object_builder.rb +++ b/lib/gitlab/import_export/group_project_object_builder.rb @@ -1,12 +1,12 @@ 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 example: - # `GroupProjectObjectBuilder.build(Label, label_attributes)` - # finds or initializes a label with the given attributes. + # Example: + # `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 diff --git a/lib/gitlab/import_export/project_tree_restorer.rb b/lib/gitlab/import_export/project_tree_restorer.rb index 8b30483a5e2..32d517ea679 100644 --- a/lib/gitlab/import_export/project_tree_restorer.rb +++ b/lib/gitlab/import_export/project_tree_restorer.rb @@ -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) |