2018-10-11 16:12:21 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-07-18 04:16:56 -04:00
|
|
|
module Gitlab
|
|
|
|
module Checks
|
|
|
|
class MatchingMergeRequest
|
|
|
|
def initialize(newrev, branch_name, project)
|
|
|
|
@newrev = newrev
|
|
|
|
@branch_name = branch_name
|
|
|
|
@project = project
|
|
|
|
end
|
|
|
|
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: disable CodeReuse/ActiveRecord
|
2016-07-18 04:16:56 -04:00
|
|
|
def match?
|
|
|
|
@project.merge_requests
|
|
|
|
.with_state(:locked)
|
|
|
|
.where(in_progress_merge_commit_sha: @newrev, target_branch: @branch_name)
|
|
|
|
.exists?
|
|
|
|
end
|
2018-08-27 11:31:01 -04:00
|
|
|
# rubocop: enable CodeReuse/ActiveRecord
|
2016-07-18 04:16:56 -04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|