Commit 15196f92 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Merge branch 'ce-gitaly-squash-in-progress' into 'master'

[CE] Incorporate Gitaly's RepositoryService.IsSquashInProgress RPC

See merge request gitlab-org/gitlab-ce!17002
parents 2c1a1e56 acc0e25d
...@@ -1234,8 +1234,14 @@ module Gitlab ...@@ -1234,8 +1234,14 @@ module Gitlab
end end
def squash_in_progress?(squash_id) def squash_in_progress?(squash_id)
gitaly_migrate(:squash_in_progress) do |is_enabled|
if is_enabled
gitaly_repository_client.squash_in_progress?(squash_id)
else
fresh_worktree?(worktree_path(SQUASH_WORKTREE_PREFIX, squash_id)) fresh_worktree?(worktree_path(SQUASH_WORKTREE_PREFIX, squash_id))
end end
end
end
def push_remote_branches(remote_name, branch_names, forced: true) def push_remote_branches(remote_name, branch_names, forced: true)
success = @gitlab_projects.push_branches(remote_name, GITLAB_PROJECTS_TIMEOUT, forced, branch_names) success = @gitlab_projects.push_branches(remote_name, GITLAB_PROJECTS_TIMEOUT, forced, branch_names)
......
...@@ -134,6 +134,23 @@ module Gitlab ...@@ -134,6 +134,23 @@ module Gitlab
response.in_progress response.in_progress
end end
def squash_in_progress?(squash_id)
request = Gitaly::IsSquashInProgressRequest.new(
repository: @gitaly_repo,
squash_id: squash_id.to_s
)
response = GitalyClient.call(
@storage,
:repository_service,
:is_squash_in_progress,
request,
timeout: GitalyClient.default_timeout
)
response.in_progress
end
def fetch_source_branch(source_repository, source_branch, local_ref) def fetch_source_branch(source_repository, source_branch, local_ref)
request = Gitaly::FetchSourceBranchRequest.new( request = Gitaly::FetchSourceBranchRequest.new(
repository: @gitaly_repo, repository: @gitaly_repo,
......
...@@ -84,4 +84,30 @@ describe Gitlab::GitalyClient::RepositoryService do ...@@ -84,4 +84,30 @@ describe Gitlab::GitalyClient::RepositoryService do
expect(client.has_local_branches?).to be(true) expect(client.has_local_branches?).to be(true)
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
let(:squash_id) { 1 }
it 'sends a repository_squash_in_progress message' do
expect_any_instance_of(Gitaly::RepositoryService::Stub)
.to receive(:is_squash_in_progress)
.with(gitaly_request_with_path(storage_name, relative_path), kind_of(Hash))
.and_return(double(in_progress: true))
client.squash_in_progress?(squash_id)
end
end
end end
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