Commit 977146f568794b56d955efd4b7df8ecaf9c97599
1 parent
b4e8fea2
Exists in
master
and in
4 other branches
Prevent creating several open merge requests for same branches
Showing
1 changed file
with
4 additions
and
0 deletions
Show diff stats
app/models/merge_request.rb
| ... | ... | @@ -91,6 +91,10 @@ class MergeRequest < ActiveRecord::Base |
| 91 | 91 | if target_branch == source_branch |
| 92 | 92 | errors.add :branch_conflict, "You can not use same branch for source and target branches" |
| 93 | 93 | end |
| 94 | + | |
| 95 | + if self.project.merge_requests.where(source_branch: source_branch, target_branch: target_branch).opened.any? | |
| 96 | + errors.add :base, "There is already an open merge request for this branches" | |
| 97 | + end | |
| 94 | 98 | end |
| 95 | 99 | |
| 96 | 100 | def reload_code | ... | ... |