diff --git a/app/controllers/repositories_controller.rb b/app/controllers/repositories_controller.rb index 2f96e2d6..78576856 100644 --- a/app/controllers/repositories_controller.rb +++ b/app/controllers/repositories_controller.rb @@ -118,11 +118,6 @@ class RepositoriesController < ApplicationController def revision @changeset = @repository.changesets.find_by_revision(@rev) raise ChangesetNotFound unless @changeset - @changes_count = @changeset.changes.size - @changes_pages = Paginator.new self, @changes_count, 150, params['page'] - @changes = @changeset.changes.find(:all, - :limit => @changes_pages.items_per_page, - :offset => @changes_pages.current.offset) respond_to do |format| format.html diff --git a/app/helpers/repositories_helper.rb b/app/helpers/repositories_helper.rb index 852ed18d..1a82bb8c 100644 --- a/app/helpers/repositories_helper.rb +++ b/app/helpers/repositories_helper.rb @@ -32,6 +32,74 @@ module RepositoriesHelper end end + def render_changeset_changes + changes = @changeset.changes.find(:all, :limit => 1000, :order => 'path').collect do |change| + case change.action + when 'A' + # Detects moved/copied files + if !change.from_path.blank? + change.action = @changeset.changes.detect {|c| c.action == 'D' && c.path == change.from_path} ? 'R' : 'C' + end + change + when 'D' + @changeset.changes.detect {|c| c.from_path == change.path} ? nil : change + else + change + end + end.compact + + tree = { } + changes.each do |change| + p = tree + dirs = change.path.to_s.split('/').select {|d| !d.blank?} + dirs.each do |dir| + p[:s] ||= {} + p = p[:s] + p[dir] ||= {} + p = p[dir] + end + p[:c] = change + end + + render_changes_tree(tree[:s]) + end + + def render_changes_tree(tree) + return '' if tree.nil? + + output = '' + output << '' + output + end + def to_utf8(str) return str if /\A[\r\n\t\x20-\x7e]*\Z/n.match(str) # for us-ascii @encodings ||= Setting.repositories_encodings.split(',').collect(&:strip) diff --git a/app/views/repositories/revision.rhtml b/app/views/repositories/revision.rhtml index 80ac3bd1..123fccf2 100644 --- a/app/views/repositories/revision.rhtml +++ b/app/views/repositories/revision.rhtml @@ -36,33 +36,19 @@ <% end %>

<%= l(:label_attachment_plural) %>

-
-
<%= l(:label_added) %> 
-
<%= l(:label_modified) %> 
-
<%= l(:label_deleted) %> 
-
+ +

<%= link_to(l(:label_view_diff), :action => 'diff', :id => @project, :path => "", :rev => @changeset.revision) if @changeset.changes.any? %>

- - -<% @changes.each do |change| %> - - - - -<% end %> - -
-<% if change.action == "D" -%> - <%= change.path -%> -<% else -%> - <%= link_to change.path, :action => 'entry', :id => @project, :path => to_path_param(change.relative_path), :rev => @changeset.revision -%> -<% end -%> -<%= "(#{change.revision})" unless change.revision.blank? %>
-<% if change.action == "M" %> -<%= link_to l(:label_view_diff), :action => 'diff', :id => @project, :path => to_path_param(change.relative_path), :rev => @changeset.revision %> -<% end %> -
-

<%= pagination_links_full @changes_pages %>

+ +
+<%= render_changeset_changes %> +
<% content_for :header_tags do %> <%= stylesheet_link_tag "scm" %> diff --git a/lang/bg.yml b/lang/bg.yml index c5c4e0e2..e072ad93 100644 --- a/lang/bg.yml +++ b/lang/bg.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/ca.yml b/lang/ca.yml index ee9e1770..895f213c 100644 --- a/lang/ca.yml +++ b/lang/ca.yml @@ -640,3 +640,5 @@ setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version. field_comments: Comment setting_commit_logs_encoding: Commit messages encoding +label_renamed: renamed +label_copied: copied diff --git a/lang/cs.yml b/lang/cs.yml index 67cfba0e..51486aec 100644 --- a/lang/cs.yml +++ b/lang/cs.yml @@ -643,3 +643,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/da.yml b/lang/da.yml index ce8b8504..2461d583 100644 --- a/lang/da.yml +++ b/lang/da.yml @@ -640,3 +640,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/de.yml b/lang/de.yml index dd1b74bf..7ee14252 100644 --- a/lang/de.yml +++ b/lang/de.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/en.yml b/lang/en.yml index 7e8ba9f5..5ad1e558 100644 --- a/lang/en.yml +++ b/lang/en.yml @@ -405,6 +405,8 @@ label_revision_plural: Revisions label_associated_revisions: Associated revisions label_added: added label_modified: modified +label_copied: copied +label_renamed: renamed label_deleted: deleted label_latest_revision: Latest revision label_latest_revision_plural: Latest revisions diff --git a/lang/es.yml b/lang/es.yml index d8f5417a..320a169f 100644 --- a/lang/es.yml +++ b/lang/es.yml @@ -641,3 +641,5 @@ setting_commit_logs_encoding: Codificación de los mensajes de commit button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/fi.yml b/lang/fi.yml index b63802e6..1953fdfe 100644 --- a/lang/fi.yml +++ b/lang/fi.yml @@ -638,3 +638,5 @@ button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers setting_commit_logs_encoding: Commit messages encoding notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/fr.yml b/lang/fr.yml index 872266e3..eb52d5a5 100644 --- a/lang/fr.yml +++ b/lang/fr.yml @@ -404,6 +404,8 @@ label_revision_plural: Révisions label_associated_revisions: Révisions associées label_added: ajouté label_modified: modifié +label_copied: copié +label_renamed: renommé label_deleted: supprimé label_latest_revision: Dernière révision label_latest_revision_plural: Dernières révisions diff --git a/lang/he.yml b/lang/he.yml index 8cd68c10..7a6c62ef 100644 --- a/lang/he.yml +++ b/lang/he.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/hu.yml b/lang/hu.yml index fa23e705..2b1f3c32 100644 --- a/lang/hu.yml +++ b/lang/hu.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit üzenetek kódlapja button_quote: Idézet setting_sequential_project_identifiers: Szekvenciális projekt azonosítók generálása notice_unable_delete_version: A verziót nem lehet törölni +label_renamed: renamed +label_copied: copied diff --git a/lang/it.yml b/lang/it.yml index 5507e6bb..25913588 100644 --- a/lang/it.yml +++ b/lang/it.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/ja.yml b/lang/ja.yml index c9470f91..c38c2ef7 100644 --- a/lang/ja.yml +++ b/lang/ja.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/ko.yml b/lang/ko.yml index 38b5a48a..27adf167 100644 --- a/lang/ko.yml +++ b/lang/ko.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/lt.yml b/lang/lt.yml index 7c62bf15..d9d19335 100644 --- a/lang/lt.yml +++ b/lang/lt.yml @@ -640,3 +640,5 @@ setting_commit_logs_encoding: Commit pranėšimų koduotė setting_sequential_project_identifiers: Generate sequential project identifiers button_quote: Quote notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/nl.yml b/lang/nl.yml index e8cab52b..746f242e 100644 --- a/lang/nl.yml +++ b/lang/nl.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/no.yml b/lang/no.yml index ce474131..2b78826d 100644 --- a/lang/no.yml +++ b/lang/no.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/pl.yml b/lang/pl.yml index 05ff1afb..6bdac481 100644 --- a/lang/pl.yml +++ b/lang/pl.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/pt-br.yml b/lang/pt-br.yml index c40c87a7..a4bbefe0 100644 --- a/lang/pt-br.yml +++ b/lang/pt-br.yml @@ -639,3 +639,5 @@ enumeration_issue_priorities: Prioridade das tarefas enumeration_doc_categories: Categorias de documento enumeration_activities: Atividades (time tracking) notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/pt.yml b/lang/pt.yml index 37e9ad6b..98cde780 100644 --- a/lang/pt.yml +++ b/lang/pt.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/ro.yml b/lang/ro.yml index ebf1c0a1..855662c5 100644 --- a/lang/ro.yml +++ b/lang/ro.yml @@ -638,3 +638,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/ru.yml b/lang/ru.yml index 5a010ea5..9ef18711 100644 --- a/lang/ru.yml +++ b/lang/ru.yml @@ -670,3 +670,5 @@ text_user_mail_option: "Для невыбранных проектов, Вы б text_user_wrote: '%s написал(а):' text_wiki_destroy_confirmation: Вы уверены, что хотите удалить данную Wiki и все содержимое? text_workflow_edit: Выберите роль и трекер для редактирования последовательности состояний +label_renamed: renamed +label_copied: copied diff --git a/lang/sr.yml b/lang/sr.yml index f7ddfd72..574470e1 100644 --- a/lang/sr.yml +++ b/lang/sr.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/sv.yml b/lang/sv.yml index b4e621c9..1e7d292d 100644 --- a/lang/sv.yml +++ b/lang/sv.yml @@ -639,3 +639,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/th.yml b/lang/th.yml index e2d8a0a4..0ad6b9b9 100644 --- a/lang/th.yml +++ b/lang/th.yml @@ -641,3 +641,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/tr.yml b/lang/tr.yml index 9fb5b63c..7cb2a9e6 100644 --- a/lang/tr.yml +++ b/lang/tr.yml @@ -639,3 +639,5 @@ setting_mail_handler_api_key: API key setting_commit_logs_encoding: Commit messages encoding general_csv_decimal_separator: '.' notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/uk.yml b/lang/uk.yml index 8e8541f1..055d27ed 100644 --- a/lang/uk.yml +++ b/lang/uk.yml @@ -640,3 +640,5 @@ setting_commit_logs_encoding: Commit messages encoding button_quote: Quote setting_sequential_project_identifiers: Generate sequential project identifiers notice_unable_delete_version: Unable to delete version +label_renamed: renamed +label_copied: copied diff --git a/lang/zh-tw.yml b/lang/zh-tw.yml index 9de70f00..a7a7767f 100644 --- a/lang/zh-tw.yml +++ b/lang/zh-tw.yml @@ -639,3 +639,5 @@ default_activity_development: 開發 enumeration_issue_priorities: 項目優先權 enumeration_doc_categories: 文件分類 enumeration_activities: 活動 (時間追蹤) +label_renamed: renamed +label_copied: copied diff --git a/lang/zh.yml b/lang/zh.yml index f66651cb..ed84eeb5 100644 --- a/lang/zh.yml +++ b/lang/zh.yml @@ -639,3 +639,5 @@ default_activity_development: 开发 enumeration_issue_priorities: 问题优先级 enumeration_doc_categories: 文档类别 enumeration_activities: 活动(时间跟踪) +label_renamed: renamed +label_copied: copied diff --git a/public/images/bullet_add.png b/public/images/bullet_add.png new file mode 100644 index 00000000..41ff8335 Binary files /dev/null and b/public/images/bullet_add.png differ diff --git a/public/images/bullet_black.png b/public/images/bullet_black.png new file mode 100644 index 00000000..57619706 Binary files /dev/null and b/public/images/bullet_black.png differ diff --git a/public/images/bullet_blue.png b/public/images/bullet_blue.png new file mode 100644 index 00000000..a7651ec8 Binary files /dev/null and b/public/images/bullet_blue.png differ diff --git a/public/images/bullet_delete.png b/public/images/bullet_delete.png new file mode 100644 index 00000000..bd6271b2 Binary files /dev/null and b/public/images/bullet_delete.png differ diff --git a/public/images/bullet_orange.png b/public/images/bullet_orange.png new file mode 100644 index 00000000..638b1ef3 Binary files /dev/null and b/public/images/bullet_orange.png differ diff --git a/public/images/bullet_purple.png b/public/images/bullet_purple.png new file mode 100644 index 00000000..52ba5036 Binary files /dev/null and b/public/images/bullet_purple.png differ diff --git a/public/images/folder_open_add.png b/public/images/folder_open_add.png new file mode 100644 index 00000000..1ce4dcae Binary files /dev/null and b/public/images/folder_open_add.png differ diff --git a/public/images/folder_open_orange.png b/public/images/folder_open_orange.png new file mode 100644 index 00000000..fb909ba9 Binary files /dev/null and b/public/images/folder_open_orange.png differ diff --git a/public/stylesheets/scm.css b/public/stylesheets/scm.css index d5a879bf..ecd31930 100644 --- a/public/stylesheets/scm.css +++ b/public/stylesheets/scm.css @@ -1,4 +1,32 @@ +div.changeset-changes ul { margin: 0; padding: 0; } +div.changeset-changes ul > ul { margin-left: 18px; padding: 0; } + +li.change { + list-style-type:none; + background-image: url(../images/bullet_black.png); + background-position: 1px 1px; + background-repeat: no-repeat; + padding-top: 1px; + padding-bottom: 1px; + padding-left: 20px; + margin: 0; +} +li.change.folder { background-image: url(../images/folder_open.png); } +li.change.folder.change-A { background-image: url(../images/folder_open_add.png); } +li.change.folder.change-M { background-image: url(../images/folder_open_orange.png); } +li.change.change-A { background-image: url(../images/bullet_add.png); } +li.change.change-M { background-image: url(../images/bullet_orange.png); } +li.change.change-C { background-image: url(../images/bullet_blue.png); } +li.change.change-R { background-image: url(../images/bullet_purple.png); } +li.change.change-D { background-image: url(../images/bullet_delete.png); } + +li.change .copied-from { font-style: italic; color: #999; font-size: 0.9em; } +li.change .copied-from:before { content: " - "} + +#changes-legend { float: right; font-size: 0.8em; margin: 0; } +#changes-legend li { float: left; background-position: 5px 0; } + table.filecontent { border: 1px solid #ccc; border-collapse: collapse; width:98%; } table.filecontent th { border: 1px solid #ccc; background-color: #eee; } table.filecontent th.filename { background-color: #e4e4d4; text-align: left; padding: 0.2em;} diff --git a/test/functional/repositories_subversion_controller_test.rb b/test/functional/repositories_subversion_controller_test.rb index 8320be7e..245a170d 100644 --- a/test/functional/repositories_subversion_controller_test.rb +++ b/test/functional/repositories_subversion_controller_test.rb @@ -125,16 +125,18 @@ class RepositoriesSubversionControllerTest < Test::Unit::TestCase get :revision, :id => 1, :rev => 2 assert_response :success assert_template 'revision' - assert_tag :tag => 'tr', - :child => { :tag => 'td', + assert_tag :tag => 'ul', + :child => { :tag => 'li', # link to the entry at rev 2 - :child => { :tag => 'a', :attributes => {:href => 'repositories/entry/ecookbook/test/some/path/in/the/repo?rev=2'}, - :content => %r{/test/some/path/in/the/repo} } - }, - :child => { :tag => 'td', - # link to partial diff - :child => { :tag => 'a', :attributes => { :href => '/repositories/diff/ecookbook/test/some/path/in/the/repo?rev=2' } } - } + :child => { :tag => 'a', + :attributes => {:href => '/repositories/entry/ecookbook/test/some/path/in/the/repo?rev=2'}, + :content => 'repo', + # link to partial diff + :sibling => { :tag => 'a', + :attributes => { :href => '/repositories/diff/ecookbook/test/some/path/in/the/repo?rev=2' } + } + } + } end def test_revision_with_repository_pointing_to_a_subdirectory @@ -145,11 +147,18 @@ class RepositoriesSubversionControllerTest < Test::Unit::TestCase get :revision, :id => 1, :rev => 2 assert_response :success assert_template 'revision' - assert_tag :tag => 'tr', - :child => { :tag => 'td', :content => %r{/test/some/path/in/the/repo} }, - :child => { :tag => 'td', - :child => { :tag => 'a', :attributes => { :href => '/repositories/diff/ecookbook/path/in/the/repo?rev=2' } } - } + assert_tag :tag => 'ul', + :child => { :tag => 'li', + # link to the entry at rev 2 + :child => { :tag => 'a', + :attributes => {:href => '/repositories/entry/ecookbook/path/in/the/repo?rev=2'}, + :content => 'repo', + # link to partial diff + :sibling => { :tag => 'a', + :attributes => { :href => '/repositories/diff/ecookbook/path/in/the/repo?rev=2' } + } + } + } end def test_diff