diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-20 12:55:51 +0300 |
commit | e8d2c2579383897a1dd7f9debd359abe8ae8373d (patch) | |
tree | c42be41678c2586d49a75cabce89322082698334 /lib/gitlab/import_export | |
parent | fc845b37ec3a90aaa719975f607740c22ba6a113 (diff) |
Add latest changes from gitlab-org/gitlab@14-1-stable-eev14.1.0-rc42
Diffstat (limited to 'lib/gitlab/import_export')
4 files changed, 25 insertions, 3 deletions
diff --git a/lib/gitlab/import_export/project/import_export.yml b/lib/gitlab/import_export/project/import_export.yml index d000c331b6d..a84978a2a80 100644 --- a/lib/gitlab/import_export/project/import_export.yml +++ b/lib/gitlab/import_export/project/import_export.yml @@ -61,7 +61,9 @@ tree: - :push_event_payload - :suggestions - merge_request_diff: - - :merge_request_diff_commits + - merge_request_diff_commits: + - :commit_author + - :committer - :merge_request_diff_files - events: - :push_event_payload @@ -201,6 +203,10 @@ excluded_attributes: - :verification_failure merge_request_diff_commits: - :merge_request_diff_id + - :commit_author_id + - :committer_id + merge_request_diff_commit_user: + - :id merge_request_diff_detail: - :merge_request_diff_id - :verification_retry_at @@ -223,6 +229,7 @@ excluded_attributes: - :promoted_to_epic_id - :blocking_issues_count - :service_desk_reply_to + - :upvotes_count merge_request: - :milestone_id - :sprint_id diff --git a/lib/gitlab/import_export/project/object_builder.rb b/lib/gitlab/import_export/project/object_builder.rb index 831e38f3034..0753625b978 100644 --- a/lib/gitlab/import_export/project/object_builder.rb +++ b/lib/gitlab/import_export/project/object_builder.rb @@ -28,6 +28,7 @@ module Gitlab def find return if epic? && group.nil? + return find_diff_commit_user if diff_commit_user? super end @@ -81,6 +82,13 @@ module Gitlab end end + def find_diff_commit_user + find_with_cache do + MergeRequest::DiffCommitUser + .find_or_create(@attributes['name'], @attributes['email']) + end + end + def label? klass == Label end @@ -101,6 +109,10 @@ module Gitlab klass == DesignManagement::Design end + def diff_commit_user? + klass == MergeRequest::DiffCommitUser + end + # If an existing group milestone used the IID # claim the IID back and set the group milestone to use one available # This is necessary to fix situations like the following: diff --git a/lib/gitlab/import_export/project/relation_factory.rb b/lib/gitlab/import_export/project/relation_factory.rb index 4678396f97e..102fcedd2fc 100644 --- a/lib/gitlab/import_export/project/relation_factory.rb +++ b/lib/gitlab/import_export/project/relation_factory.rb @@ -31,7 +31,9 @@ module Gitlab ci_cd_settings: 'ProjectCiCdSetting', error_tracking_setting: 'ErrorTracking::ProjectErrorTrackingSetting', links: 'Releases::Link', - metrics_setting: 'ProjectMetricsSetting' }.freeze + metrics_setting: 'ProjectMetricsSetting', + commit_author: 'MergeRequest::DiffCommitUser', + committer: 'MergeRequest::DiffCommitUser' }.freeze BUILD_MODELS = %i[Ci::Build commit_status].freeze @@ -56,6 +58,7 @@ module Gitlab external_pull_request external_pull_requests DesignManagement::Design + MergeRequest::DiffCommitUser ].freeze def create diff --git a/lib/gitlab/import_export/relation_tree_restorer.rb b/lib/gitlab/import_export/relation_tree_restorer.rb index 46b82240ef7..d5f924ae2bd 100644 --- a/lib/gitlab/import_export/relation_tree_restorer.rb +++ b/lib/gitlab/import_export/relation_tree_restorer.rb @@ -37,7 +37,7 @@ module Gitlab ActiveRecord::Base.no_touching do update_params! - BulkInsertableAssociations.with_bulk_insert(enabled: @importable.class == ::Project) do + BulkInsertableAssociations.with_bulk_insert(enabled: @importable.instance_of?(::Project)) do fix_ci_pipelines_not_sorted_on_legacy_project_json! create_relations! end |