Mercurial > hg > soundsoftware-site
diff app/models/repository/subversion.rb @ 1338:25603efa57b5
Merge from live branch
author | Chris Cannam |
---|---|
date | Thu, 20 Jun 2013 13:14:14 +0100 |
parents | 51d7f3e06556 |
children | 4f746d8966dd 51364c0cd58f |
line wrap: on
line diff
--- a/app/models/repository/subversion.rb Wed Jan 23 13:11:25 2013 +0000 +++ b/app/models/repository/subversion.rb Thu Jun 20 13:14:14 2013 +0100 @@ -1,5 +1,5 @@ # Redmine - project management software -# Copyright (C) 2006-2011 Jean-Philippe Lang +# Copyright (C) 2006-2012 Jean-Philippe Lang # # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License @@ -15,7 +15,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -require 'redmine/scm/adapters/subversion_adapter' +require_dependency 'redmine/scm/adapters/subversion_adapter' class Repository::Subversion < Repository attr_protected :root_url @@ -40,7 +40,12 @@ def latest_changesets(path, rev, limit=10) revisions = scm.revisions(path, rev, nil, :limit => limit) - revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : [] + if revisions + identifiers = revisions.collect(&:identifier).compact + changesets.where(:revision => identifiers).reorder("committed_on DESC").includes(:repository, :user).all + else + [] + end end # Returns a path relative to the url of the repository @@ -81,6 +86,24 @@ end end + protected + + def load_entries_changesets(entries) + return unless entries + + entries_with_identifier = entries.select {|entry| entry.lastrev && entry.lastrev.identifier.present?} + identifiers = entries_with_identifier.map {|entry| entry.lastrev.identifier}.compact.uniq + + if identifiers.any? + changesets_by_identifier = changesets.where(:revision => identifiers).includes(:user, :repository).all.group_by(&:revision) + entries_with_identifier.each do |entry| + if m = changesets_by_identifier[entry.lastrev.identifier] + entry.changeset = m.first + end + end + end + end + private # Returns the relative url of the repository