Commit 940c0508 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Check for existing MR only for opened/reopened MR

parent e7c930a5
......@@ -92,6 +92,7 @@ class MergeRequest < ActiveRecord::Base
errors.add :branch_conflict, "You can not use same branch for source and target branches"
end
if opened? || reopened?
similar_mrs = self.project.merge_requests.where(source_branch: source_branch, target_branch: target_branch).opened
similar_mrs = similar_mrs.where('id not in (?)', self.id) if self.id
......@@ -99,6 +100,7 @@ class MergeRequest < ActiveRecord::Base
errors.add :base, "There is already an open merge request for this branches"
end
end
end
def reload_code
self.reloaded_commits
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment