diff options
author | Sean McGivern <sean@mcgivern.me.uk> | 2018-07-04 13:39:59 +0300 |
---|---|---|
committer | Sean McGivern <sean@mcgivern.me.uk> | 2018-07-04 13:39:59 +0300 |
commit | 7a355f6856a59d88bea777ba237652ed00476418 (patch) | |
tree | fb3bf54b96d006617e805b1966f8db29c9ab95c2 /lib | |
parent | 48bbb36347c1c5d4d7922e1998c47d235eb71208 (diff) | |
parent | 201802f7234b4b5f1c8859404981052a0316677f (diff) |
Merge branch 'gitaly-mandatory-20180703-jv-2' into 'master'
Remove more Gitaly feature flags
Closes gitaly#329, gitaly#320, gitaly#323, and gitaly#328
See merge request gitlab-org/gitlab-ce!20343
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/commit_stats.rb | 16 | ||||
-rw-r--r-- | lib/gitlab/git/repository.rb | 25 | ||||
-rw-r--r-- | lib/gitlab/git/tree.rb | 10 | ||||
-rw-r--r-- | lib/gitlab/gitaly_client/repository_service.rb | 2 |
4 files changed, 10 insertions, 43 deletions
diff --git a/lib/gitlab/git/commit_stats.rb b/lib/gitlab/git/commit_stats.rb index 8463b1eb794..ae6f554bc06 100644 --- a/lib/gitlab/git/commit_stats.rb +++ b/lib/gitlab/git/commit_stats.rb @@ -1,5 +1,3 @@ -# Gitaly note: JV: 1 RPC, migration in progress. - # Gitlab::Git::CommitStats counts the additions, deletions, and total changes # in a commit. module Gitlab @@ -16,12 +14,8 @@ module Gitlab @deletions = 0 @total = 0 - repo.gitaly_migrate(:commit_stats) do |is_enabled| - if is_enabled - gitaly_stats(repo, commit) - else - rugged_stats(commit) - end + repo.wrapped_gitaly_errors do + gitaly_stats(repo, commit) end end @@ -31,12 +25,6 @@ module Gitlab @deletions = stats.deletions @total = @additions + @deletions end - - def rugged_stats(commit) - diff = commit.rugged_diff_from_parent - _files_changed, @additions, @deletions = diff.stat - @total = @additions + @deletions - end end end end diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb index 12fd6898694..647f54d5b84 100644 --- a/lib/gitlab/git/repository.rb +++ b/lib/gitlab/git/repository.rb @@ -251,7 +251,6 @@ module Gitlab # Returns an Array of Tags # - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/390 def tags wrapped_gitaly_errors do gitaly_ref_client.tags @@ -598,17 +597,9 @@ module Gitlab # @repository.submodule_url_for('master', 'rack') # # => git@localhost:rack.git # - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/329 def submodule_url_for(ref, path) - Gitlab::GitalyClient.migrate(:submodule_url_for) do |is_enabled| - if is_enabled - gitaly_submodule_url_for(ref, path) - else - if submodules(ref).any? - submodule = submodules(ref)[path] - submodule['url'] if submodule - end - end + wrapped_gitaly_errors do + gitaly_submodule_url_for(ref, path) end end @@ -833,22 +824,14 @@ module Gitlab # Ex. # repo.ls_files('master') # - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/327 def ls_files(ref) gitaly_commit_client.ls_files(ref) end - # Gitaly migration: https://gitlab.com/gitlab-org/gitaly/issues/328 def copy_gitattributes(ref) - Gitlab::GitalyClient.migrate(:apply_gitattributes) do |is_enabled| - if is_enabled - gitaly_copy_gitattributes(ref) - else - rugged_copy_gitattributes(ref) - end + wrapped_gitaly_errors do + gitaly_repository_client.apply_gitattributes(ref) end - rescue GRPC::InvalidArgument - raise InvalidRef end def info_attributes diff --git a/lib/gitlab/git/tree.rb b/lib/gitlab/git/tree.rb index b6ceb542dd1..cb851b76a23 100644 --- a/lib/gitlab/git/tree.rb +++ b/lib/gitlab/git/tree.rb @@ -1,5 +1,3 @@ -# Gitaly note: JV: needs 1 RPC, migration is in progress. - module Gitlab module Git class Tree @@ -17,12 +15,8 @@ module Gitlab def where(repository, sha, path = nil, recursive = false) path = nil if path == '' || path == '/' - Gitlab::GitalyClient.migrate(:tree_entries) do |is_enabled| - if is_enabled - repository.gitaly_commit_client.tree_entries(repository, sha, path, recursive) - else - tree_entries_from_rugged(repository, sha, path, recursive) - end + repository.wrapped_gitaly_errors do + repository.gitaly_commit_client.tree_entries(repository, sha, path, recursive) end end diff --git a/lib/gitlab/gitaly_client/repository_service.rb b/lib/gitlab/gitaly_client/repository_service.rb index ca986434221..cd0da0f6e88 100644 --- a/lib/gitlab/gitaly_client/repository_service.rb +++ b/lib/gitlab/gitaly_client/repository_service.rb @@ -48,6 +48,8 @@ module Gitlab def apply_gitattributes(revision) request = Gitaly::ApplyGitattributesRequest.new(repository: @gitaly_repo, revision: encode_binary(revision)) GitalyClient.call(@storage, :repository_service, :apply_gitattributes, request) + rescue GRPC::InvalidArgument => ex + raise Gitlab::Git::Repository::InvalidRef, ex end def info_attributes |