]> source.dussan.org Git - redmine.git/commitdiff
SCM:
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 1 Sep 2009 12:13:17 +0000 (12:13 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Tue, 1 Sep 2009 12:13:17 +0000 (12:13 +0000)
* add latest changesets for the current directory when browsing the repository and a link to the full log
* ability to diff a directory (#3575)

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2849 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/repositories_controller.rb
app/views/repositories/_link_to_functions.rhtml
app/views/repositories/_revisions.rhtml
app/views/repositories/diff.rhtml
app/views/repositories/show.rhtml
config/locales/fr.yml
test/functional/repositories_subversion_controller_test.rb

index d5e1352a10f73e67e06811a4661ace12d915c0f4..938ace9bab6f42adfdf370f5f96976d884f5483d 100644 (file)
@@ -72,9 +72,7 @@ class RepositoriesController < ApplicationController
       @entries ? render(:partial => 'dir_list_content') : render(:nothing => true)
     else
       show_error_not_found and return unless @entries
-      if @path.blank?
-        @changesets = @repository.latest_changesets(@path, @rev)
-      end
+      @changesets = @repository.latest_changesets(@path, @rev)
       @properties = @repository.properties(@path, @rev)
       render :action => 'show'
     end
index a699938def006e2c140643b1fc83264bf730a858..412d5f86f05aa0c14c99936c14ab55cece4a2636 100644 (file)
@@ -1,3 +1,5 @@
+<% if @entry && @entry.kind == 'file' %>
+
 <p>
 <%= link_to_if action_name != 'changes', l(:label_history), {:action => 'changes', :id => @project, :path => to_path_param(@path), :rev => @rev } %> |
 <% if @repository.supports_cat? %>
@@ -9,3 +11,5 @@
 <%= link_to(l(:button_download), {:action => 'entry', :id => @project, :path => to_path_param(@path), :rev => @rev, :format => 'raw' }) if @repository.supports_cat? %>
 <%= "(#{number_to_human_size(@entry.size)})" if @entry.size %>
 </p>
+
+<% end %>
index fb0131c824f958e8063f7a431290b4d464996022..8fb15525f617cc3380243df1a4f62a2895c91ddc 100644 (file)
@@ -9,7 +9,7 @@
 <th><%= l(:field_comments) %></th>
 </tr></thead>
 <tbody>
-<% show_diff = entry && entry.is_file? && revisions.size > 1 %>
+<% show_diff = revisions.size > 1 %>
 <% line_num = 1 %>
 <% revisions.each do |changeset| %>
 <tr class="changeset <%= cycle 'odd', 'even' %>">
index 8538f30deacce9937f66b2c06b7945d9a48da2fa..73e13abf4fc6bb83eabaeaba454930add9c53320 100644 (file)
@@ -1,4 +1,4 @@
-<h2><%= l(:label_revision) %> <%= format_revision(@rev) %> <%= @path.gsub(/^.*\//, '') %></h2>
+<h2><%= l(:label_revision) %> <%= format_revision(@rev_to) + ':' if @rev_to %><%= format_revision(@rev) %> <%=h @path %></h2>
 
 <!-- Choose view type -->
 <% form_tag({}, :method => 'get') do %>
index a3057ddaa795ff7365d4605207be5cb051390f51..35106fe6f8306960ca7b433b44f5146e45f7d885 100644 (file)
 
 <% if @changesets && !@changesets.empty? && authorize_for('repositories', 'revisions') %>
 <h3><%= l(:label_latest_revision_plural) %></h3>
-<%= render :partial => 'revisions', :locals => {:project => @project, :path => '', :revisions => @changesets, :entry => nil }%>
-<p><%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project %></p>
+<%= render :partial => 'revisions', :locals => {:project => @project, :path => @path, :revisions => @changesets, :entry => nil }%>
+
+<% if @path.blank? %>
+       <p><%= link_to l(:label_view_all_revisions), :action => 'revisions', :id => @project %></p>
+<% else %>
+       <p><%= link_to l(:label_view_revisions), :action => 'changes', :path => to_path_param(@path), :id => @project %></p>
+<% end %>
+
 <% content_for :header_tags do %>
   <%= auto_discovery_link_tag(:atom, params.merge({:format => 'atom', :action => 'revisions', :id => @project, :page => nil, :key => User.current.rss_key})) %>
 <% end %>
index 51483f7056638e7368d50825e894c0e34955f6cb..f37580b107435a10cd01b7afb54c7bc4ef11972d 100644 (file)
@@ -833,7 +833,7 @@ fr:
   enumeration_activities: Activités (suivi du temps)
   label_greater_or_equal: ">="
   label_less_or_equal: "<="
-  label_view_all_revisions: View all revisions
+  label_view_all_revisions: Voir toutes les révisions
   label_tag: Tag
   label_branch: Branch
   error_no_tracker_in_project: No tracker is associated to this project. Please check the Project settings.
index 8e4affadeb4036c588ec088f6276948929814e40..fe1b3dbe50c5a210a651d051f72a75ddae108720 100644 (file)
@@ -75,7 +75,7 @@ class RepositoriesSubversionControllerTest < Test::Unit::TestCase
       assert_equal ['folder', '.project', 'helloworld.c', 'helloworld.rb', 'textfile.txt'], assigns(:entries).collect(&:name)
     end
     
-    def test_changes
+    def test_file_changes
       get :changes, :id => 1, :path => ['subversion_test', 'folder', 'helloworld.rb' ]
       assert_response :success
       assert_template 'changes'
@@ -94,6 +94,16 @@ class RepositoriesSubversionControllerTest < Test::Unit::TestCase
                                :child => { :tag => 'span', :content => 'native' } }
       end
     end
+
+    def test_directory_changes
+      get :changes, :id => 1, :path => ['subversion_test', 'folder' ]
+      assert_response :success
+      assert_template 'changes'
+      
+      changesets = assigns(:changesets)
+      assert_not_nil changesets
+      assert_equal %w(7 6 5 2), changesets.collect(&:revision)
+    end
       
     def test_entry
       get :entry, :id => 1, :path => ['subversion_test', 'helloworld.c']
@@ -181,11 +191,22 @@ class RepositoriesSubversionControllerTest < Test::Unit::TestCase
                             }
     end
     
-    def test_diff
+    def test_revision_diff
       get :diff, :id => 1, :rev => 3
       assert_response :success
       assert_template 'diff'
     end
+
+    def test_directory_diff
+      get :diff, :id => 1, :rev => 6, :rev_to => 2, :path => ['subversion_test', 'folder']
+      assert_response :success
+      assert_template 'diff'
+      
+      diff = assigns(:diff)
+      assert_not_nil diff
+      # 2 files modified
+      assert_equal 2, Redmine::UnifiedDiff.new(diff).size
+    end
     
     def test_annotate
       get :annotate, :id => 1, :path => ['subversion_test', 'helloworld.c']