diff options
Diffstat (limited to 'app/models/repository')
-rw-r--r-- | app/models/repository/cvs.rb | 2 | ||||
-rw-r--r-- | app/models/repository/git.rb | 2 | ||||
-rw-r--r-- | app/models/repository/mercurial.rb | 5 | ||||
-rw-r--r-- | app/models/repository/subversion.rb | 2 |
4 files changed, 6 insertions, 5 deletions
diff --git a/app/models/repository/cvs.rb b/app/models/repository/cvs.rb index 09d79c4fb..abc408304 100644 --- a/app/models/repository/cvs.rb +++ b/app/models/repository/cvs.rb @@ -199,7 +199,7 @@ class Repository::Cvs < Repository # Need to retrieve existing revision numbers to sort them as integers sql = "SELECT revision FROM #{Changeset.table_name} " sql << "WHERE repository_id = #{id} AND revision NOT LIKE 'tmp%'" - @current_revision_number ||= (connection.select_values(sql).collect(&:to_i).max || 0) + @current_revision_number ||= (self.class.connection.select_values(sql).collect(&:to_i).max || 0) @current_revision_number += 1 end end diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb index c51a7e58a..978944efc 100644 --- a/app/models/repository/git.rb +++ b/app/models/repository/git.rb @@ -241,7 +241,7 @@ class Repository::Git < Repository def latest_changesets(path,rev,limit=10) revisions = scm.revisions(path, nil, rev, :limit => limit, :all => false) return [] if revisions.nil? || revisions.empty? - changesets.where(:scmid => revisions.map {|c| c.scmid}).all + changesets.where(:scmid => revisions.map {|c| c.scmid}).to_a end def clear_extra_info_of_changesets diff --git a/app/models/repository/mercurial.rb b/app/models/repository/mercurial.rb index abe1dfb70..81dd24d00 100644 --- a/app/models/repository/mercurial.rb +++ b/app/models/repository/mercurial.rb @@ -20,7 +20,7 @@ require 'redmine/scm/adapters/mercurial_adapter' class Repository::Mercurial < Repository # sort changesets by revision number has_many :changesets, - :order => "#{Changeset.table_name}.id DESC", + lambda {order("#{Changeset.table_name}.id DESC")}, :foreign_key => 'repository_id' attr_protected :root_url @@ -117,9 +117,10 @@ class Repository::Mercurial < Repository changesets. includes(:user). where(latest_changesets_cond(path, rev, limit)). + references(:user). limit(limit). order("#{Changeset.table_name}.id DESC"). - all + to_a end def is_short_id_in_db? diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb index 532c1f3a2..1659b77f8 100644 --- a/app/models/repository/subversion.rb +++ b/app/models/repository/subversion.rb @@ -42,7 +42,7 @@ class Repository::Subversion < Repository revisions = scm.revisions(path, rev, nil, :limit => limit) if revisions identifiers = revisions.collect(&:identifier).compact - changesets.where(:revision => identifiers).reorder("committed_on DESC").includes(:repository, :user).all + changesets.where(:revision => identifiers).reorder("committed_on DESC").includes(:repository, :user).to_a else [] end |