Fixed: deleted files should not be shown when browsing a Darcs repository (#2385).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2189 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
76a9101998
commit
a7a4c9f848
|
@ -84,7 +84,7 @@ module Redmine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil if $? && $?.exitstatus != 0
|
return nil if $? && $?.exitstatus != 0
|
||||||
entries.sort_by_name
|
entries.compact.sort_by_name
|
||||||
end
|
end
|
||||||
|
|
||||||
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
|
def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
|
||||||
|
@ -148,15 +148,22 @@ module Redmine
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
# Returns an Entry from the given XML element
|
||||||
|
# or nil if the entry was deleted
|
||||||
def entry_from_xml(element, path_prefix)
|
def entry_from_xml(element, path_prefix)
|
||||||
|
modified_element = element.elements['modified']
|
||||||
|
if modified_element.elements['modified_how'].text.match(/removed/)
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
Entry.new({:name => element.attributes['name'],
|
Entry.new({:name => element.attributes['name'],
|
||||||
:path => path_prefix + element.attributes['name'],
|
:path => path_prefix + element.attributes['name'],
|
||||||
:kind => element.name == 'file' ? 'file' : 'dir',
|
:kind => element.name == 'file' ? 'file' : 'dir',
|
||||||
:size => nil,
|
:size => nil,
|
||||||
:lastrev => Revision.new({
|
:lastrev => Revision.new({
|
||||||
:identifier => nil,
|
:identifier => nil,
|
||||||
:scmid => element.elements['modified'].elements['patch'].attributes['hash']
|
:scmid => modified_element.elements['patch'].attributes['hash']
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
end
|
end
|
||||||
|
|
|
@ -49,6 +49,12 @@ class RepositoryDarcsTest < Test::Unit::TestCase
|
||||||
assert_equal 6, @repository.changesets.count
|
assert_equal 6, @repository.changesets.count
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_deleted_files_should_not_be_listed
|
||||||
|
entries = @repository.entries('sources')
|
||||||
|
assert entries.detect {|e| e.name == 'watchers_controller.rb'}
|
||||||
|
assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
|
||||||
|
end
|
||||||
|
|
||||||
def test_cat
|
def test_cat
|
||||||
@repository.fetch_changesets
|
@repository.fetch_changesets
|
||||||
cat = @repository.cat("sources/welcome_controller.rb", 2)
|
cat = @repository.cat("sources/welcome_controller.rb", 2)
|
||||||
|
|
Loading…
Reference in New Issue