Commit ea6d8c05 authored by James Fargher's avatar James Fargher

Merge branch 'toon-remove-gitaly-rebase-in-progress' into 'master'

git: Remove Repository#rebase_in_progress?

See merge request gitlab-org/gitlab!65856
parents abdb6c6f ec2a6897
...@@ -18,12 +18,6 @@ module MergeRequests ...@@ -18,12 +18,6 @@ module MergeRequests
end end
def rebase def rebase
# Ensure Gitaly isn't already running a rebase
if source_project.repository.rebase_in_progress?(merge_request.id)
log_error(exception: nil, message: 'Rebase task canceled: Another rebase is already in progress', save_message_on_model: true)
return false
end
repository.rebase(current_user, merge_request, skip_ci: @skip_ci) repository.rebase(current_user, merge_request, skip_ci: @skip_ci)
true true
......
...@@ -883,12 +883,6 @@ module Gitlab ...@@ -883,12 +883,6 @@ module Gitlab
end end
end end
def rebase_in_progress?(rebase_id)
wrapped_gitaly_errors do
gitaly_repository_client.rebase_in_progress?(rebase_id)
end
end
def squash(user, squash_id, start_sha:, end_sha:, author:, message:) def squash(user, squash_id, start_sha:, end_sha:, author:, message:)
wrapped_gitaly_errors do wrapped_gitaly_errors do
gitaly_operation_client.user_squash(user, squash_id, start_sha, end_sha, author, message) gitaly_operation_client.user_squash(user, squash_id, start_sha, end_sha, author, message)
......
...@@ -152,23 +152,6 @@ module Gitlab ...@@ -152,23 +152,6 @@ module Gitlab
) )
end end
def rebase_in_progress?(rebase_id)
request = Gitaly::IsRebaseInProgressRequest.new(
repository: @gitaly_repo,
rebase_id: rebase_id.to_s
)
response = GitalyClient.call(
@storage,
:repository_service,
:is_rebase_in_progress,
request,
timeout: GitalyClient.fast_timeout
)
response.in_progress
end
def squash_in_progress?(squash_id) def squash_in_progress?(squash_id)
request = Gitaly::IsSquashInProgressRequest.new( request = Gitaly::IsSquashInProgressRequest.new(
repository: @gitaly_repo, repository: @gitaly_repo,
......
...@@ -209,19 +209,6 @@ RSpec.describe Gitlab::GitalyClient::RepositoryService do ...@@ -209,19 +209,6 @@ RSpec.describe Gitlab::GitalyClient::RepositoryService do
end end
end end
describe '#rebase_in_progress?' do
let(:rebase_id) { 1 }
it 'sends a repository_rebase_in_progress message' do
expect_any_instance_of(Gitaly::RepositoryService::Stub)
.to receive(:is_rebase_in_progress)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return(double(in_progress: true))
client.rebase_in_progress?(rebase_id)
end
end
describe '#squash_in_progress?' do describe '#squash_in_progress?' do
let(:squash_id) { 1 } let(:squash_id) { 1 }
......
...@@ -25,30 +25,6 @@ RSpec.describe MergeRequests::RebaseService do ...@@ -25,30 +25,6 @@ RSpec.describe MergeRequests::RebaseService do
end end
describe '#execute' do describe '#execute' do
context 'when another rebase is already in progress' do
before do
allow(repository).to receive(:rebase_in_progress?).with(merge_request.id).and_return(true)
end
it 'saves the error message' do
service.execute(merge_request)
expect(merge_request.reload.merge_error).to eq 'Rebase task canceled: Another rebase is already in progress'
end
it 'returns an error' do
expect(service.execute(merge_request)).to match(status: :error,
message: described_class::REBASE_ERROR)
end
it 'clears rebase_jid' do
expect { service.execute(merge_request) }
.to change { merge_request.rebase_jid }
.from(rebase_jid)
.to(nil)
end
end
shared_examples 'sequence of failure and success' do shared_examples 'sequence of failure and success' do
it 'properly clears the error message' do it 'properly clears the error message' do
allow(repository).to receive(:gitaly_operation_client).and_raise('Something went wrong') allow(repository).to receive(:gitaly_operation_client).and_raise('Something went wrong')
...@@ -150,6 +126,13 @@ RSpec.describe MergeRequests::RebaseService do ...@@ -150,6 +126,13 @@ RSpec.describe MergeRequests::RebaseService do
it_behaves_like 'a service that can execute a successful rebase' it_behaves_like 'a service that can execute a successful rebase'
it 'clears rebase_jid' do
expect { service.execute(merge_request) }
.to change(merge_request, :rebase_jid)
.from(rebase_jid)
.to(nil)
end
context 'when skip_ci flag is set' do context 'when skip_ci flag is set' do
let(:skip_ci) { true } let(:skip_ci) { true }
......
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