diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-06 13:31:39 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2016-10-06 13:31:39 +0300 |
commit | cd58410811564130e6975c62fe77d2c9fccce46f (patch) | |
tree | a426ccc802eb4d8b775ca7e348730d61014c3e8e /app | |
parent | 9824a69c8a4028b757a3d13d7ed4251589d20589 (diff) |
Remove support for branch-less builds in MWBS
See !6675#note_16580143
Diffstat (limited to 'app')
-rw-r--r-- | app/services/merge_requests/base_service.rb | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/app/services/merge_requests/base_service.rb b/app/services/merge_requests/base_service.rb index 4f4c1c77ec3..58f69a41e14 100644 --- a/app/services/merge_requests/base_service.rb +++ b/app/services/merge_requests/base_service.rb @@ -42,20 +42,19 @@ module MergeRequests super(:merge_request) end - def merge_requests_for(branches, sha) - # This is for ref-less builds - branches ||= @project.repository.branch_names_contains(sha) + def merge_requests_for(branch) + origin_merge_requests = @project.origin_merge_requests + .opened.where(source_branch: branch).to_a - return [] if branches.blank? + fork_merge_requests = @project.fork_merge_requests + .opened.where(source_branch: branch).to_a - merge_requests = @project.origin_merge_requests.opened.where(source_branch: branches).to_a - merge_requests += @project.fork_merge_requests.opened.where(source_branch: branches).to_a - - merge_requests.uniq.select(&:source_project) + (origin_merge_requests + fork_merge_requests) + .uniq.select(&:source_project) end def pipeline_merge_requests(pipeline) - merge_requests_for(pipeline.ref, pipeline.sha).each do |merge_request| + merge_requests_for(pipeline.ref).each do |merge_request| next unless pipeline == merge_request.pipeline yield merge_request @@ -63,8 +62,9 @@ module MergeRequests end def commit_status_merge_requests(commit_status) - merge_requests_for(commit_status.ref, commit_status.sha).each do |merge_request| + merge_requests_for(commit_status.ref).each do |merge_request| pipeline = merge_request.pipeline + next unless pipeline next unless pipeline.sha == commit_status.sha |