diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 00:08:11 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-03 00:08:11 +0000 |
commit | bd8fb5668ae739a83d55ec5ca4a04344eef2167e (patch) | |
tree | baf085c6cd58b3b5e5a192d4d3db360d623bb056 /lib/gitlab/import_export | |
parent | 561e1b470f0a99fe6304c8f197348c47a637d594 (diff) | |
download | gitlab-ce-bd8fb5668ae739a83d55ec5ca4a04344eef2167e.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'lib/gitlab/import_export')
-rw-r--r-- | lib/gitlab/import_export/project/tree_restorer.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/project/tree_saver.rb | 2 | ||||
-rw-r--r-- | lib/gitlab/import_export/relation_rename_service.rb | 48 |
3 files changed, 0 insertions, 52 deletions
diff --git a/lib/gitlab/import_export/project/tree_restorer.rb b/lib/gitlab/import_export/project/tree_restorer.rb index a5123f16dbc..904cb461ac3 100644 --- a/lib/gitlab/import_export/project/tree_restorer.rb +++ b/lib/gitlab/import_export/project/tree_restorer.rb @@ -21,8 +21,6 @@ module Gitlab @tree_hash = read_tree_hash @project_members = @tree_hash.delete('project_members') - RelationRenameService.rename(@tree_hash) - if relation_tree_restorer.restore import_failure_service.with_retry(action: 'set_latest_merge_request_diff_ids!') do @project.merge_requests.set_latest_merge_request_diff_ids! diff --git a/lib/gitlab/import_export/project/tree_saver.rb b/lib/gitlab/import_export/project/tree_saver.rb index 58f33a04851..32b3b518ece 100644 --- a/lib/gitlab/import_export/project/tree_saver.rb +++ b/lib/gitlab/import_export/project/tree_saver.rb @@ -35,8 +35,6 @@ module Gitlab end project_tree['project_members'] += group_members_array - - RelationRenameService.add_new_associations(project_tree) end def reader diff --git a/lib/gitlab/import_export/relation_rename_service.rb b/lib/gitlab/import_export/relation_rename_service.rb deleted file mode 100644 index 03aaa6aefc3..00000000000 --- a/lib/gitlab/import_export/relation_rename_service.rb +++ /dev/null @@ -1,48 +0,0 @@ -# frozen_string_literal: true - -# This class is intended to help with relation renames within Gitlab versions -# and allow compatibility between versions. -# If you have to change one relationship name that is imported/exported, -# you should add it to the RENAMES constant indicating the old name and the -# new one. -# The behavior of these renamed relationships should be transient and it should -# only last one release until you completely remove the renaming from the list. -# -# When importing, this class will check the hash and: -# - if only the old relationship name is found, it will rename it with the new one -# - if only the new relationship name is found, it will do nothing -# - if it finds both, it will use the new relationship data -# -# When exporting, this class will duplicate the keys in the resulting file. -# This way, if we open the file in an old version of the exporter it will work -# and also it will with the newer versions. -module Gitlab - module ImportExport - class RelationRenameService - RENAMES = { - 'pipelines' => 'ci_pipelines' # Added in 11.6, remove in 11.7 - }.freeze - - def self.rename(tree_hash) - return unless tree_hash&.present? - - RENAMES.each do |old_name, new_name| - old_entry = tree_hash.delete(old_name) - - next if tree_hash[new_name] - next unless old_entry - - tree_hash[new_name] = old_entry - end - end - - def self.add_new_associations(tree_hash) - RENAMES.each do |old_name, new_name| - next if tree_hash.key?(old_name) - - tree_hash[old_name] = tree_hash[new_name] - end - end - end - end -end |