Commit 5c945507 authored by Bob Van Landuyt's avatar Bob Van Landuyt

Merge branch 'zj-working-copy-service-removal' into 'master'

Remove WorkingCopyBaseService

Closes #36067

See merge request gitlab-org/gitlab!19934
parents 9498add5 563b27f4
# frozen_string_literal: true # frozen_string_literal: true
module MergeRequests module Git
class WorkingCopyBaseService < MergeRequests::BaseService module Logger
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) def log_error(message, save_message_on_model: false)
Gitlab::GitLogger.error("#{self.class.name} error (#{merge_request.to_reference(full: true)}): #{message}") 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 merge_request.update(merge_error: message) if save_message_on_model
end end
# Don't try to print expensive instance variables.
def inspect
"#<#{self.class} #{merge_request.to_reference(full: true)}>"
end
end end
end end
...@@ -29,6 +29,19 @@ module MergeRequests ...@@ -29,6 +29,19 @@ module MergeRequests
.execute_for_merge_request(merge_request) .execute_for_merge_request(merge_request)
end 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 private
def create(merge_request) def create(merge_request)
......
# frozen_string_literal: true # frozen_string_literal: true
module MergeRequests module MergeRequests
class RebaseService < MergeRequests::WorkingCopyBaseService class RebaseService < MergeRequests::BaseService
include Git::Logger
REBASE_ERROR = 'Rebase failed. Please rebase locally' REBASE_ERROR = 'Rebase failed. Please rebase locally'
attr_reader :merge_request
def execute(merge_request) def execute(merge_request)
@merge_request = merge_request @merge_request = merge_request
......
# frozen_string_literal: true # frozen_string_literal: true
module MergeRequests module MergeRequests
class SquashService < MergeRequests::WorkingCopyBaseService class SquashService < MergeRequests::BaseService
include Git::Logger
def execute def execute
# If performing a squash would result in no change, then # If performing a squash would result in no change, then
# immediately return a success message without performing a squash # immediately return a success message without performing a squash
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment