Unverified Commit 098ee55e authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Use CompareService in collecting diff when create MR


Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 8cdb7f63bc6e
......@@ -83,11 +83,7 @@ def load_diffs(raw)
# Collect array of Git::Commit objects
# between target and source branches
def unmerged_commits
commits = if merge_request.for_fork?
compare_action.commits
else
repository.commits_between(target_branch, source_branch)
end
commits = compare_result.commits
if commits.present?
commits = Commit.decorate(commits).
......@@ -147,12 +143,7 @@ def reload_diffs
# Collect array of Git::Diff objects
# between target and source branches
def unmerged_diffs
diffs = if merge_request.for_fork?
compare_action.diffs
else
Gitlab::Git::Diff.between(repository, source_branch, target_branch)
end
diffs = compare_result.diffs
diffs ||= []
diffs
rescue Gitlab::Git::Diff::TimeoutError => ex
......@@ -166,13 +157,13 @@ def repository
private
def compare_action
Gitlab::Satellite::CompareAction.new(
def compare_result
@compare_result ||= CompareService.new.execute(
merge_request.author,
merge_request.source_project,
merge_request.source_branch,
merge_request.target_project,
merge_request.target_branch,
merge_request.source_project,
merge_request.source_branch
)
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