]> source.dussan.org Git - redmine.git/commitdiff
scm: cvs: fix CVS diffs do not handle new files properly (#7615).
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 24 Feb 2011 04:03:43 +0000 (04:03 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Thu, 24 Feb 2011 04:03:43 +0000 (04:03 +0000)
Contributed by Jim Naslund.

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

lib/redmine/scm/adapters/cvs_adapter.rb
test/functional/repositories_cvs_controller_test.rb

index 365d440414d4217544d44ec7d19aed6f6c69416d..25d4e420eb0b4d01eab06c14c85ccf6d0b10a42d 100644 (file)
@@ -378,7 +378,11 @@ module Redmine
         private
         def buildRevision(rev)
           if rev== 0
-            @base
+            if @branchid.nil?
+              @base+".0"
+            else
+              @base
+            end
           elsif @branchid.nil? 
             @base+"."+rev.to_s
           else
index 5e2a1dc915851733816cd4c6ae975453013a4bc6..ca040e3f2be6bc2883e839aea7abb61ff04e9b00 100644 (file)
@@ -154,6 +154,24 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
       assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
                                :content => /watched.remove_all_watcher/
     end
+                               
+    def test_diff_new_files
+      @repository.fetch_changesets
+      @repository.reload
+      get :diff, :id => PRJ_ID, :rev => 1, :type => 'inline'
+      assert_response :success
+      assert_template 'diff'
+      assert_tag :tag => 'td', :attributes => { :class => 'line-code diff_in' },
+                               :content => /watched.remove_watcher/
+      assert_tag :tag => 'th', :attributes => { :class => 'filename' },
+                               :content => /test\/README/
+      assert_tag :tag => 'th', :attributes => { :class => 'filename' },
+                               :content => /test\/images\/delete.png   /
+      assert_tag :tag => 'th', :attributes => { :class => 'filename' },
+                               :content => /test\/images\/edit.png/
+      assert_tag :tag => 'th', :attributes => { :class => 'filename' },
+                               :content => /test\/sources\/watchers_controller.rb/                        
+    end
 
     def test_annotate
       @repository.fetch_changesets