diff options
author | Andrew Kumanyaev <me@zzet.org> | 2013-10-08 16:45:57 +0400 |
---|---|---|
committer | Andrew Kumanyaev <me@zzet.org> | 2013-10-08 16:45:57 +0400 |
commit | 9ee49c5c49ee5f44efee5cd91117c6b45c0ce825 (patch) | |
tree | 103654ba82e954836572c0bfac441bbb9bd6abea /app/models/project.rb | |
parent | c147b571f4dbb6a6c6b104173f91c3a94f5be0f9 (diff) | |
download | gitlab-ce-9ee49c5c49ee5f44efee5cd91117c6b45c0ce825.tar.gz |
Update merge requests from fork project to origin project
Fix error described in https://github.com/gitlabhq/gitlabhq/issues/5185
Diffstat (limited to 'app/models/project.rb')
-rw-r--r-- | app/models/project.rb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/project.rb b/app/models/project.rb index 8755ffa69b8..d2dcf26ac69 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -53,6 +53,7 @@ class Project < ActiveRecord::Base has_many :services, dependent: :destroy has_many :events, dependent: :destroy has_many :merge_requests, dependent: :destroy, foreign_key: "target_project_id" + has_many :fork_merge_requests,dependent: :destroy, foreign_key: "source_project_id", class_name: MergeRequest has_many :issues, dependent: :destroy, order: "state DESC, created_at DESC" has_many :milestones, dependent: :destroy has_many :notes, dependent: :destroy @@ -312,8 +313,11 @@ class Project < ActiveRecord::Base branch_name = ref.gsub("refs/heads/", "") c_ids = self.repository.commits_between(oldrev, newrev).map(&:id) - # Update code for merge requests + # Update code for merge requests into project between project branches mrs = self.merge_requests.opened.by_branch(branch_name).all + # Update code for merge requests between project and project fork + mrs += self.fork_merge_requests.opened.by_branch(branch_name).all + mrs.each { |merge_request| merge_request.reload_code; merge_request.mark_as_unchecked } # Close merge requests |