diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-15 21:06:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2019-11-15 21:06:24 +0300 |
commit | eca3cd3a9e7d9ea680086cad8150050ec8cdef3f (patch) | |
tree | c3d262e0d8e721fc138c2d617f501fb09876f1b6 /app/services/merge_requests | |
parent | 6e81d7f6283fae1b22f66b9d9b133243921cbd9e (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/services/merge_requests')
-rw-r--r-- | app/services/merge_requests/base_service.rb | 13 | ||||
-rw-r--r-- | app/services/merge_requests/rebase_service.rb | 6 | ||||
-rw-r--r-- | app/services/merge_requests/squash_service.rb | 4 | ||||
-rw-r--r-- | app/services/merge_requests/working_copy_base_service.rb | 26 |
4 files changed, 21 insertions, 28 deletions
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index aacc3d6831e..00bf69739ad 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -29,6 +29,19 @@ module MergeRequests .execute_for_merge_request(merge_request) end + def source_project + @source_project ||= merge_request.source_project + end + + def target_project + @target_project ||= merge_request.target_project + end + + # Don't try to print expensive instance variables. + def inspect + "#<#{self.class} #{merge_request.to_reference(full: true)}>" + end + private def create(merge_request) diff --git a/app/services/merge_requests/rebase_service.rb b/app/services/merge_requests/rebase_service.rb index 4d36dd4feae..7e9442c0c7c 100644 --- a/app/services/merge_requests/rebase_service.rb +++ b/app/services/merge_requests/rebase_service.rb @@ -1,9 +1,13 @@ # frozen_string_literal: true module MergeRequests - class RebaseService < MergeRequests::WorkingCopyBaseService + class RebaseService < MergeRequests::BaseService + include Git::Logger + REBASE_ERROR = 'Rebase failed. Please rebase locally' + attr_reader :merge_request + def execute(merge_request) @merge_request = merge_request diff --git a/app/services/merge_requests/squash_service.rb b/app/services/merge_requests/squash_service.rb index 88ca3b4f5a8..d25997c925e 100644 --- a/app/services/merge_requests/squash_service.rb +++ b/app/services/merge_requests/squash_service.rb @@ -1,7 +1,9 @@ # frozen_string_literal: true module MergeRequests - class SquashService < MergeRequests::WorkingCopyBaseService + class SquashService < MergeRequests::BaseService + include Git::Logger + def execute # If performing a squash would result in no change, then # immediately return a success message without performing a squash diff --git a/app/services/merge_requests/working_copy_base_service.rb b/app/services/merge_requests/working_copy_base_service.rb deleted file mode 100644 index 2d2be1f4c25..00000000000 --- a/app/services/merge_requests/working_copy_base_service.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -module MergeRequests - class WorkingCopyBaseService < MergeRequests::BaseService - attr_reader :merge_request - - def source_project - @source_project ||= merge_request.source_project - end - - def target_project - @target_project ||= merge_request.target_project - end - - def log_error(message, save_message_on_model: false) - Gitlab::GitLogger.error("#{self.class.name} error (#{merge_request.to_reference(full: true)}): #{message}") - - merge_request.update(merge_error: message) if save_message_on_model - end - - # Don't try to print expensive instance variables. - def inspect - "#<#{self.class} #{merge_request.to_reference(full: true)}>" - end - end -end |