Commit 563b27f4 authored by Zeger-Jan van de Weg's avatar Zeger-Jan van de Weg Committed by Bob Van Landuyt

Remove WorkingCopyBaseService

The working copy for squash and rebases, among other git operations, has
been a concern of Gitaly for a long time. This service is an old
artifact of the time GitLab-Rails was responsible for it.

This service contains little code, and the code it did contain I've
moved to the usual base service.

Closes: https://gitlab.com/gitlab-org/gitlab/issues/36067
parent 9498add5
# 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
module Git
module Logger
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
......@@ -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)
......
# 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
......
# 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
......
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