diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-05 12:10:33 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-10-05 12:10:33 +0000 |
commit | a5675463352040ae8e63b0ba6c20a27dbfefc0d3 (patch) | |
tree | 5c5d97326aa0a81d96edee9563e2e90cf70d4a6d /app/models/repository.rb | |
parent | 8b678837a353747f6f4fcce343c603daf1e07fbe (diff) | |
download | redmine-a5675463352040ae8e63b0ba6c20a27dbfefc0d3.tar.gz redmine-a5675463352040ae8e63b0ba6c20a27dbfefc0d3.zip |
Don't link multiple changesets from the same commit multiple times (#17931).
git-svn-id: http://svn.redmine.org/redmine/trunk@13427 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/repository.rb')
-rw-r--r-- | app/models/repository.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/repository.rb b/app/models/repository.rb index fe08e95ce..25b0e1da8 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -442,6 +442,18 @@ class Repository < ActiveRecord::Base end end + # Returns a scope of changesets that come from the same commit as the given changeset + # in different repositories that point to the same backend + def same_commits_in_scope(scope, changeset) + scope = scope.joins(:repository).where(:repositories => {:url => url, :root_url => root_url, :type => type}) + if changeset.scmid.present? + scope = scope.where(:scmid => changeset.scmid) + else + scope = scope.where(:revision => changeset.revision) + end + scope + end + protected def check_default |