From e61916ea91e4c24663608d418d9e78a81ffbb735 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Tue, 18 Nov 2008 18:36:47 +0000 Subject: [PATCH] SubversionAdapter#entries performance improvement. git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2045 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- lib/redmine/scm/adapters/subversion_adapter.rb | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb index dff225e44..0a96ed654 100644 --- a/lib/redmine/scm/adapters/subversion_adapter.rb +++ b/lib/redmine/scm/adapters/subversion_adapter.rb @@ -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 -- 2.39.5