diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb
index 3cec2e8e..a90b57c3 100644
--- a/app/controllers/repositories_controller.rb
+++ b/app/controllers/repositories_controller.rb
@@ -88,7 +88,7 @@ class RepositoriesController < ApplicationController
def changes
@entry = @repository.entry(@path, @rev)
show_error_not_found and return unless @entry
- @changesets = @repository.changesets_for_path(@path)
+ @changesets = @repository.changesets_for_path(@path, :limit => Setting.repository_log_display_limit.to_i)
@properties = @repository.properties(@path, @rev)
end
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 003f3055..920cf246 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -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
diff --git a/app/models/repository/git.rb b/app/models/repository/git.rb
index 41d4b649..f721b938 100644
--- a/app/models/repository/git.rb
+++ b/app/models/repository/git.rb
@@ -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
diff --git a/app/models/repository/subversion.rb b/app/models/repository/subversion.rb
index 9515e6b7..a7458970 100644
--- a/app/models/repository/subversion.rb
+++ b/app/models/repository/subversion.rb
@@ -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
diff --git a/app/views/settings/_repositories.rhtml b/app/views/settings/_repositories.rhtml
index a8c92443..a20fc513 100644
--- a/app/views/settings/_repositories.rhtml
+++ b/app/views/settings/_repositories.rhtml
@@ -19,6 +19,9 @@
<%= select_tag 'settings[commit_logs_encoding]', options_for_select(Setting::ENCODINGS, Setting.commit_logs_encoding) %>
+
+
+<%= text_field_tag 'settings[repository_log_display_limit]', Setting.repository_log_display_limit, :size => 6 %>