scm: cvs: fix CVS diffs do not handle new files properly (#7615).

Contributed by Jim Naslund.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@4939 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-02-24 04:03:43 +00:00 committed by Eric Davis
parent 5fe46b215b
commit 12c5dcbd13
2 changed files with 23 additions and 1 deletions

View 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

View 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