diff options
Diffstat (limited to 'ruby')
-rw-r--r-- | ruby/lib/gitaly_server/operations_service.rb | 30 | ||||
-rw-r--r-- | ruby/lib/gitlab/git/repository.rb | 44 | ||||
-rw-r--r-- | ruby/proto/gitaly/version.rb | 2 |
3 files changed, 1 insertions, 75 deletions
diff --git a/ruby/lib/gitaly_server/operations_service.rb b/ruby/lib/gitaly_server/operations_service.rb index 9aae9b84a..e905828c4 100644 --- a/ruby/lib/gitaly_server/operations_service.rb +++ b/ruby/lib/gitaly_server/operations_service.rb @@ -20,36 +20,6 @@ module GitalyServer Gitaly::UserUpdateBranchResponse.new(pre_receive_error: set_utf8!(ex.message)) end - def user_revert(request, call) - repo = Gitlab::Git::Repository.from_gitaly(request.repository, call) - user = Gitlab::Git::User.from_gitaly(request.user) - commit = Gitlab::Git::Commit.new(repo, request.commit) - start_repository = Gitlab::Git::GitalyRemoteRepository.new(request.start_repository || request.repository, call) - - result = repo.revert( - user: user, - commit: commit, - branch_name: request.branch_name, - message: request.message.dup, - start_branch_name: request.start_branch_name.presence, - start_repository: start_repository, - dry_run: request.dry_run, - timestamp: request.timestamp - ) - - branch_update = branch_update_result(result) - Gitaly::UserRevertResponse.new(branch_update: branch_update) - rescue Gitlab::Git::Repository::CreateTreeError => e - Gitaly::UserRevertResponse.new( - create_tree_error: set_utf8!(e.message), - create_tree_error_code: e.error.upcase - ) - rescue Gitlab::Git::CommitError => e - Gitaly::UserRevertResponse.new(commit_error: set_utf8!(e.message)) - rescue Gitlab::Git::PreReceiveError => e - Gitaly::UserRevertResponse.new(pre_receive_error: set_utf8!(e.message)) - end - # rubocop:disable Metrics/AbcSize def user_rebase_confirmable(session, call) Enumerator.new do |y| diff --git a/ruby/lib/gitlab/git/repository.rb b/ruby/lib/gitlab/git/repository.rb index 678849def..a05c25757 100644 --- a/ruby/lib/gitlab/git/repository.rb +++ b/ruby/lib/gitlab/git/repository.rb @@ -209,37 +209,6 @@ module Gitlab OperationService.new(user, self).update_branch(branch_name, newrev, oldrev, push_options: push_options, transaction: transaction) end - # rubocop:disable Metrics/ParameterLists - def revert(user:, commit:, branch_name:, message:, start_branch_name:, start_repository:, dry_run: false, timestamp: nil) - OperationService.new(user, self).with_branch( - branch_name, - start_branch_name: start_branch_name, - start_repository: start_repository - ) do |start_commit| - - revert_tree_id = check_revert_content(commit, start_commit.sha) - - if dry_run - # At this point the tree has been written to the object database but - # not committed, so we'll leave it to be cleaned up by `gc`. - # - # The response expects a SHA, so just return the starting one. - start_commit.sha - else - committer = user_to_committer(user, timestamp) - - create_commit( - message: message, - author: committer, - committer: committer, - tree: revert_tree_id, - parents: [start_commit.sha] - ) - end - end - end - # rubocop:enable Metrics/ParameterLists - def diff_exists?(sha1, sha2) rugged.diff(sha1, sha2).size.positive? end @@ -499,19 +468,6 @@ module Gitlab output end - def check_revert_content(target_commit, source_sha) - args = [target_commit.sha, source_sha] - args << { mainline: 1 } if target_commit.merge_commit? - - revert_index = rugged.revert_commit(*args) - raise CreateTreeError, :conflict if revert_index.conflicts? - - tree_id = revert_index.write_tree(rugged) - raise CreateTreeError, :empty unless diff_exists?(source_sha, tree_id) - - tree_id - end - def branches_filter(filter: nil, sort_by: nil) branches = rugged.branches.each(filter).map do |rugged_ref| begin diff --git a/ruby/proto/gitaly/version.rb b/ruby/proto/gitaly/version.rb index 6e6903559..077923d02 100644 --- a/ruby/proto/gitaly/version.rb +++ b/ruby/proto/gitaly/version.rb @@ -2,5 +2,5 @@ # (https://gitlab.com/gitlab-org/release-tools/), and should not be # modified. module Gitaly - VERSION = '14.0.0-rc2' + VERSION = '14.1.0-rc1' end |