SubversionAdapter#entries performance improvement.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2045 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2008-11-18 18:36:47 +00:00
parent 86504acb4c
commit e61916ea91
1 changed files with 10 additions and 7 deletions

View File

@ -84,17 +84,20 @@ module Redmine
begin
doc = REXML::Document.new(output)
doc.elements.each("lists/list/entry") do |entry|
commit = entry.elements['commit']
commit_date = commit.elements['date']
# Skip directory if there is no commit date (usually that
# means that we don't have read access to it)
next if entry.attributes['kind'] == 'dir' && entry.elements['commit'].elements['date'].nil?
entries << Entry.new({:name => URI.unescape(entry.elements['name'].text),
:path => ((path.empty? ? "" : "#{path}/") + entry.elements['name'].text),
next if entry.attributes['kind'] == 'dir' && commit_date.nil?
name = entry.elements['name'].text
entries << Entry.new({:name => URI.unescape(name),
:path => ((path.empty? ? "" : "#{path}/") + name),
:kind => entry.attributes['kind'],
:size => (entry.elements['size'] and entry.elements['size'].text).to_i,
:size => ((s = entry.elements['size']) ? s.text.to_i : nil),
:lastrev => Revision.new({
:identifier => entry.elements['commit'].attributes['revision'],
:time => Time.parse(entry.elements['commit'].elements['date'].text).localtime,
:author => (entry.elements['commit'].elements['author'] ? entry.elements['commit'].elements['author'].text : "")
:identifier => commit.attributes['revision'],
:time => Time.parse(commit_date.text).localtime,
:author => ((a = commit.elements['author']) ? a.text : nil)
})
})
end