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
parent e51aeb5a40
commit a2e47f9fba
2 changed files with 23 additions and 1 deletions

View File

@ -378,7 +378,11 @@ module Redmine
private private
def buildRevision(rev) def buildRevision(rev)
if rev== 0 if rev== 0
if @branchid.nil?
@base+".0"
else
@base @base
end
elsif @branchid.nil? elsif @branchid.nil?
@base+"."+rev.to_s @base+"."+rev.to_s
else else

View File

@ -155,6 +155,24 @@ class RepositoriesCvsControllerTest < ActionController::TestCase
:content => /watched.remove_all_watcher/ :content => /watched.remove_all_watcher/
end 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 def test_annotate
@repository.fetch_changesets @repository.fetch_changesets
@repository.reload @repository.reload