diff options
author | Sean McGivern <sean@gitlab.com> | 2016-08-04 14:20:04 +0100 |
---|---|---|
committer | Fatih Acet <acetfatih@gmail.com> | 2016-08-12 23:24:48 +0300 |
commit | ba327e69ec4b2214f12f577cd86a37c65ea2f3e9 (patch) | |
tree | 8b869b02caae808510156aa4936dfe1123b61db9 /lib/gitlab/conflict | |
parent | ac9229a31be8e672efdcc63b702a2039ae66ad46 (diff) | |
download | gitlab-ce-ba327e69ec4b2214f12f577cd86a37c65ea2f3e9.tar.gz |
Move resolving code to ResolveService
Diffstat (limited to 'lib/gitlab/conflict')
-rw-r--r-- | lib/gitlab/conflict/file.rb | 8 | ||||
-rw-r--r-- | lib/gitlab/conflict/file_collection.rb | 21 |
2 files changed, 0 insertions, 29 deletions
diff --git a/lib/gitlab/conflict/file.rb b/lib/gitlab/conflict/file.rb index 6284b0dd377..3560fae5b09 100644 --- a/lib/gitlab/conflict/file.rb +++ b/lib/gitlab/conflict/file.rb @@ -28,14 +28,6 @@ module Gitlab parent_file: self) end - def resolve!(resolution, index:, rugged:) - new_file = resolve_lines(resolution).map(&:text).join("\n") - - oid = rugged.write(new_file, :blob) - index.add(path: our_path, oid: oid, mode: our_mode) - index.conflict_remove(our_path) - end - def resolve_lines(resolution) section_id = nil diff --git a/lib/gitlab/conflict/file_collection.rb b/lib/gitlab/conflict/file_collection.rb index 04a75f9edc3..e8157fb9e91 100644 --- a/lib/gitlab/conflict/file_collection.rb +++ b/lib/gitlab/conflict/file_collection.rb @@ -20,27 +20,6 @@ module Gitlab @merge_index ||= repository.rugged.merge_commits(our_commit, their_commit) end - def resolve_conflicts!(params, user:) - resolutions = params[:sections] - commit_message = params[:commit_message] || default_commit_message - rugged = repository.rugged - committer = repository.user_to_committer(user) - - files.each do |file| - file.resolve!(resolutions, index: merge_index, rugged: rugged) - end - - new_tree = merge_index.write_tree(rugged) - - Rugged::Commit.create(rugged, - author: committer, - committer: committer, - tree: new_tree, - message: commit_message, - parents: [our_commit, their_commit].map(&:oid), - update_ref: Gitlab::Git::BRANCH_REF_PREFIX + merge_request.source_branch) - end - def files @files ||= merge_index.conflicts.map do |conflict| raise ConflictSideMissing unless conflict[:theirs] && conflict[:ours] |