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:
parent
d3b2049851
commit
ab5e07e83e
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -19,6 +19,9 @@
|
|||
|
||||
<p><label><%= l(:setting_commit_logs_encoding) %></label>
|
||||
<%= select_tag 'settings[commit_logs_encoding]', options_for_select(Setting::ENCODINGS, Setting.commit_logs_encoding) %></p>
|
||||
|
||||
<p><label><%= l(:setting_repository_log_display_limit) %></label>
|
||||
<%= text_field_tag 'settings[repository_log_display_limit]', Setting.repository_log_display_limit, :size => 6 %></p>
|
||||
</div>
|
||||
|
||||
<fieldset class="box tabular settings"><legend><%= l(:text_issues_ref_in_commit_messages) %></legend>
|
||||
|
|
|
@ -132,6 +132,9 @@ repositories_encodings:
|
|||
# encoding used to convert commit logs to UTF-8
|
||||
commit_logs_encoding:
|
||||
default: 'UTF-8'
|
||||
repository_log_display_limit:
|
||||
format: int
|
||||
default: 100
|
||||
ui_theme:
|
||||
default: ''
|
||||
emails_footer:
|
||||
|
|
|
@ -702,3 +702,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -707,3 +707,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -704,3 +704,4 @@ text_repository_usernames_mapping: "Select or update the Redmine user mapped to
|
|||
permission_edit_time_entries: Edit time logs
|
||||
general_csv_decimal_separator: '.'
|
||||
permission_edit_own_time_entries: Edit own time logs
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -705,3 +705,4 @@ field_editable: Editable
|
|||
label_display: Display
|
||||
button_create_and_continue: Create and continue
|
||||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -227,6 +227,7 @@ setting_mail_handler_api_key: API key
|
|||
setting_sequential_project_identifiers: Generate sequential project identifiers
|
||||
setting_gravatar_enabled: Use Gravatar user icons
|
||||
setting_diff_max_lines_displayed: Max number of diff lines displayed
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
||||
permission_edit_project: Edit project
|
||||
permission_select_project_modules: Select project modules
|
||||
|
|
|
@ -687,3 +687,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -702,3 +702,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -227,6 +227,7 @@ setting_mail_handler_api_key: Clé de protection de l'API
|
|||
setting_sequential_project_identifiers: Générer des identifiants de projet séquentiels
|
||||
setting_gravatar_enabled: Afficher les Gravatar des utilisateurs
|
||||
setting_diff_max_lines_displayed: Nombre maximum de lignes de diff affichées
|
||||
setting_repository_log_display_limit: "Nombre maximum de revisions affichées sur l'historique d'un fichier"
|
||||
|
||||
permission_edit_project: Modifier le projet
|
||||
permission_select_project_modules: Choisir les modules
|
||||
|
|
|
@ -687,3 +687,4 @@ text_plugin_assets_writable: Plugin assets directory writable
|
|||
label_display: Display
|
||||
button_create_and_continue: Create and continue
|
||||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -702,3 +702,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: Létrehozás és folytatás
|
|||
text_custom_field_possible_values_info: 'Értékenként egy sor'
|
||||
label_display: Megmutat
|
||||
field_editable: Szerkeszthető
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -702,3 +702,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: 連続作成
|
|||
text_custom_field_possible_values_info: '選択肢の値は1行に1個ずつ記述してください。'
|
||||
label_display: 表示
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -702,3 +702,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -704,3 +704,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -687,3 +687,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -721,3 +721,4 @@ field_editable: Editable
|
|||
label_display: Display
|
||||
button_create_and_continue: Create and continue
|
||||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: Criar e continuar
|
|||
text_custom_field_possible_values_info: 'Uma linha para cada valor'
|
||||
label_display: Exibição
|
||||
field_editable: Editável
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -704,3 +704,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -702,3 +702,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -737,3 +737,4 @@ text_custom_field_possible_values_info: 'По одному значению в
|
|||
label_display: Отображение
|
||||
field_editable: Редактируемый
|
||||
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -707,3 +707,4 @@ field_editable: Editable
|
|||
label_display: Display
|
||||
button_create_and_continue: Create and continue
|
||||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -704,3 +704,4 @@ text_plugin_assets_writable: Plugin assets directory writable
|
|||
label_display: Display
|
||||
button_create_and_continue: Create and continue
|
||||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,4 +703,5 @@ default_activity_development: Utveckling
|
|||
|
||||
enumeration_issue_priorities: Ärendeprioriteter
|
||||
enumeration_doc_categories: Dokumentkategorier
|
||||
enumeration_activities: Aktiviteter (tidsuppföljning
|
||||
enumeration_activities: Aktiviteter (tidsuppföljning)
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -705,3 +705,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -703,3 +703,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -704,3 +704,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -705,3 +705,4 @@ button_create_and_continue: Create and continue
|
|||
text_custom_field_possible_values_info: 'One line for each value'
|
||||
label_display: Display
|
||||
field_editable: Editable
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -705,3 +705,4 @@ default_activity_development: 開發
|
|||
enumeration_issue_priorities: 項目優先權
|
||||
enumeration_doc_categories: 文件分類
|
||||
enumeration_activities: 活動 (時間追蹤)
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -705,3 +705,4 @@ default_activity_development: 开发
|
|||
enumeration_issue_priorities: 问题优先级
|
||||
enumeration_doc_categories: 文档类别
|
||||
enumeration_activities: 活动(时间跟踪)
|
||||
setting_repository_log_display_limit: Maximum number of revisions displayed on file log
|
||||
|
|
|
@ -141,6 +141,7 @@ module Redmine
|
|||
cmd = "#{SVN_BIN} log --xml -r #{identifier_from}:#{identifier_to}"
|
||||
cmd << credentials_string
|
||||
cmd << " --verbose " if options[:with_paths]
|
||||
cmd << " --limit #{options[:limit].to_i}" if options[:limit]
|
||||
cmd << ' ' + target(URI.escape(path))
|
||||
shellout(cmd) do |io|
|
||||
begin
|
||||
|
|
|
@ -48,6 +48,13 @@ class RepositorySubversionTest < Test::Unit::TestCase
|
|||
@repository.fetch_changesets
|
||||
assert_equal 8, @repository.changesets.count
|
||||
end
|
||||
|
||||
def test_changesets_for_path_with_limit
|
||||
@repository.fetch_changesets
|
||||
changesets = @repository.changesets_for_path('', :limit => 2)
|
||||
assert_equal 2, changesets.size
|
||||
assert_equal @repository.changesets_for_path('').slice(0,2), changesets
|
||||
end
|
||||
else
|
||||
puts "Subversion test repository NOT FOUND. Skipping unit tests !!!"
|
||||
def test_fake; assert true end
|
||||
|
|
Loading…
Reference in New Issue