app/services/merge_requests/merge_when_build_succeeds_service.rb
def merge_request_from(commit_status)
      branches = commit_status.ref

      # This is for ref-less builds
      branches ||= @project.repository.branch_names_contains(commit_status.sha)

      return [] if branches.blank?

      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)
    end
# Marks the passed `merge_request` to be merged when the build succeeds or
# updates the params for the automatic merge
Marks the passed `merge_request` to be merged when the build succeeds or
updates the params for the automatic merge
Marks the passed ` merge_request ` to be merged when the build succeeds or updates the params for the automatic merge
def merge_request_from(commit_status)
      branches = commit_status.ref
      branches ||= @project.repository.branch_names_contains(commit_status.sha)
      return [] if branches.blank?
      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)
    end
def merge_request_from ( commit_status ) branches = commit_status . ref branches ||= @project . repository . branch_names_contains ( commit_status . sha ) return [ ] if branches . blank? 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 ) end
Marks the passed `merge_request` to be merged when the build succeeds or
updates the params for the automatic merge
Marks the passed ` merge_request ` to be merged when the build succeeds or updates the params for the automatic merge
# This is for ref-less builds
commit_status