Class: Gitlab::Checks::MatchingMergeRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/gitlab/checks/matching_merge_request.rb

Instance Method Summary collapse

Constructor Details

#initialize(newrev, branch_name, project) ⇒ MatchingMergeRequest

Returns a new instance of MatchingMergeRequest.


6
7
8
9
10
# File 'lib/gitlab/checks/matching_merge_request.rb', line 6

def initialize(newrev, branch_name, project)
  @newrev = newrev
  @branch_name = branch_name
  @project = project
end

Instance Method Details

#match?Boolean

rubocop: disable CodeReuse/ActiveRecord

Returns:

  • (Boolean)

13
14
15
16
17
18
# File 'lib/gitlab/checks/matching_merge_request.rb', line 13

def match?
  @project.merge_requests
    .with_state(:locked)
    .where(in_progress_merge_commit_sha: @newrev, target_branch: @branch_name)
    .exists?
end