diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-03 20:38:44 +0300 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-03 20:38:44 +0300 |
commit | 1764e1b7cb2bffb9b4c4a69991fe2c4d21ce5459 (patch) | |
tree | b48ca1bad0532a37a19f00f0903a778109a16a3d /app/services/merge_requests/build_service.rb | |
parent | e1bc808746523309476913033b104345c06c4816 (diff) |
Use Gitlab::Git::DiffCollections
Diffstat (limited to 'app/services/merge_requests/build_service.rb')
-rw-r--r-- | app/services/merge_requests/build_service.rb | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/app/services/merge_requests/build_service.rb b/app/services/merge_requests/build_service.rb index c0700d953dd..954746a39a5 100644 --- a/app/services/merge_requests/build_service.rb +++ b/app/services/merge_requests/build_service.rb @@ -5,9 +5,7 @@ module MergeRequests # Set MR attributes merge_request.can_be_created = false - merge_request.compare_failed = false merge_request.compare_commits = [] - merge_request.compare_diffs = [] merge_request.source_project = project unless merge_request.source_project merge_request.target_project ||= (project.forked_from_project || project) merge_request.target_branch ||= merge_request.target_project.default_branch @@ -21,35 +19,23 @@ module MergeRequests return build_failed(merge_request, message) end - compare_result = CompareService.new.execute( + compare = CompareService.new.execute( merge_request.source_project, merge_request.source_branch, merge_request.target_project, merge_request.target_branch, ) - commits = compare_result.commits + commits = compare.commits # At this point we decide if merge request can be created # If we have at least one commit to merge -> creation allowed if commits.present? merge_request.compare_commits = Commit.decorate(commits, merge_request.source_project) merge_request.can_be_created = true - merge_request.compare_failed = false - - # Try to collect diff for merge request. - diffs = compare_result.diffs - - if diffs.present? - merge_request.compare_diffs = diffs - - elsif diffs == false - merge_request.can_be_created = false - merge_request.compare_failed = true - end + merge_request.compare = compare else merge_request.can_be_created = false - merge_request.compare_failed = false end commits = merge_request.compare_commits |