From 8a491dbae94b8fbb4ca4241cba7650c81380e98e Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 Jun 2012 18:32:48 +0000 Subject: [PATCH] Faster changesets loading for subversion. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9806 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/repository/subversion.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb index 55dfb44f0..98c5bc108 100644 --- a/app/models/repository/subversion.rb +++ b/app/models/repository/subversion.rb @@ -81,6 +81,22 @@ class Repository::Subversion < Repository end end + protected + + def load_entries_changesets(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