##// END OF EJS Templates
Fixed: deleted files should not be shown when browsing a Darcs repository (#2385)....
Jean-Philippe Lang -
r2187:a7a4c9f84878
parent child
Show More
@@ -84,7 +84,7 module Redmine
84 end
84 end
85 end
85 end
86 return nil if $? && $?.exitstatus != 0
86 return nil if $? && $?.exitstatus != 0
87 entries.sort_by_name
87 entries.compact.sort_by_name
88 end
88 end
89
89
90 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
90 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={})
@@ -148,15 +148,22 module Redmine
148 end
148 end
149
149
150 private
150 private
151
151
152 # Returns an Entry from the given XML element
153 # or nil if the entry was deleted
152 def entry_from_xml(element, path_prefix)
154 def entry_from_xml(element, path_prefix)
155 modified_element = element.elements['modified']
156 if modified_element.elements['modified_how'].text.match(/removed/)
157 return nil
158 end
159
153 Entry.new({:name => element.attributes['name'],
160 Entry.new({:name => element.attributes['name'],
154 :path => path_prefix + element.attributes['name'],
161 :path => path_prefix + element.attributes['name'],
155 :kind => element.name == 'file' ? 'file' : 'dir',
162 :kind => element.name == 'file' ? 'file' : 'dir',
156 :size => nil,
163 :size => nil,
157 :lastrev => Revision.new({
164 :lastrev => Revision.new({
158 :identifier => nil,
165 :identifier => nil,
159 :scmid => element.elements['modified'].elements['patch'].attributes['hash']
166 :scmid => modified_element.elements['patch'].attributes['hash']
160 })
167 })
161 })
168 })
162 end
169 end
@@ -49,6 +49,12 class RepositoryDarcsTest < Test::Unit::TestCase
49 assert_equal 6, @repository.changesets.count
49 assert_equal 6, @repository.changesets.count
50 end
50 end
51
51
52 def test_deleted_files_should_not_be_listed
53 entries = @repository.entries('sources')
54 assert entries.detect {|e| e.name == 'watchers_controller.rb'}
55 assert_nil entries.detect {|e| e.name == 'welcome_controller.rb'}
56 end
57
52 def test_cat
58 def test_cat
53 @repository.fetch_changesets
59 @repository.fetch_changesets
54 cat = @repository.cat("sources/welcome_controller.rb", 2)
60 cat = @repository.cat("sources/welcome_controller.rb", 2)
General Comments 0
You need to be logged in to leave comments. Login now