2018-12-13 13:39:08 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-08-24 12:49:21 +05:30
|
|
|
module Gitlab
|
|
|
|
module Checks
|
|
|
|
class MatchingMergeRequest
|
|
|
|
def initialize(newrev, branch_name, project)
|
|
|
|
@newrev = newrev
|
|
|
|
@branch_name = branch_name
|
|
|
|
@project = project
|
|
|
|
end
|
|
|
|
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2016-08-24 12:49:21 +05:30
|
|
|
def match?
|
|
|
|
@project.merge_requests
|
|
|
|
.with_state(:locked)
|
|
|
|
.where(in_progress_merge_commit_sha: @newrev, target_branch: @branch_name)
|
|
|
|
.exists?
|
|
|
|
end
|
2018-12-05 23:21:45 +05:30
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2016-08-24 12:49:21 +05:30
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2021-01-03 14:25:43 +05:30
|
|
|
|
|
|
|
Gitlab::Checks::MatchingMergeRequest.prepend_if_ee('EE::Gitlab::Checks::MatchingMergeRequest')
|