Adds a setting to limit the number of revisions displayed on a repository file log (default=100).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2350 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang
2009-02-01 19:54:50 +00:00
parent d3b2049851
commit ab5e07e83e
41 changed files with 58 additions and 9 deletions
+4 -3
View File
@@ -76,11 +76,12 @@ class Repository < ActiveRecord::Base
end
# Default behaviour: we search in cached changesets
def changesets_for_path(path)
def changesets_for_path(path, options={})
path = "/#{path}" unless path.starts_with?('/')
Change.find(:all, :include => {:changeset => :user},
:conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.id DESC").collect(&:changeset)
:conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.id DESC",
:limit => options[:limit]).collect(&:changeset)
end
# Returns a path relative to the url of the repository
+3 -2
View File
@@ -29,10 +29,11 @@ class Repository::Git < Repository
'Git'
end
def changesets_for_path(path)
def changesets_for_path(path, options={})
Change.find(:all, :include => {:changeset => :user},
:conditions => ["repository_id = ? AND path = ?", id, path],
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC").collect(&:changeset)
:order => "committed_on DESC, #{Changeset.table_name}.revision DESC",
:limit => options[:limit]).collect(&:changeset)
end
def fetch_changesets
+2 -2
View File
@@ -30,8 +30,8 @@ class Repository::Subversion < Repository
'Subversion'
end
def changesets_for_path(path)
revisions = scm.revisions(path)
def changesets_for_path(path, options={})
revisions = scm.revisions(path, nil, nil, :limit => options[:limit])
revisions ? changesets.find_all_by_revision(revisions.collect(&:identifier), :order => "committed_on DESC", :include => :user) : []
end