scm: cvs: code clean up adapter entries().

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5086 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Toshi MARUYAMA 2011-03-11 01:48:36 +00:00 committed by Eric Davis
parent bbaa90c59f
commit 8010bd6351
1 changed files with 17 additions and 13 deletions

View File

@ -103,32 +103,36 @@ module Redmine
cmd_args << "-D" << time_to_cvstime(identifier) if identifier cmd_args << "-D" << time_to_cvstime(identifier) if identifier
cmd_args << path_with_project cmd_args << path_with_project
scm_cmd(*cmd_args) do |io| scm_cmd(*cmd_args) do |io|
io.each_line(){|line| io.each_line() do |line|
fields=line.chop.split('/',-1) fields = line.chop.split('/',-1)
logger.debug(">>InspectLine #{fields.inspect}") logger.debug(">>InspectLine #{fields.inspect}")
if fields[0]!="D" if fields[0]!="D"
entries << Entry.new({:name => fields[-5], entries << Entry.new(
{
:name => fields[-5],
#:path => fields[-4].include?(path)?fields[-4]:(path + "/"+ fields[-4]), #:path => fields[-4].include?(path)?fields[-4]:(path + "/"+ fields[-4]),
:path => "#{path}/#{fields[-5]}", :path => "#{path}/#{fields[-5]}",
:kind => 'file', :kind => 'file',
:size => nil, :size => nil,
:lastrev => Revision.new({ :lastrev => Revision.new(
:revision => fields[-4], {
:name => fields[-4], :revision => fields[-4],
:time => Time.parse(fields[-3]), :name => fields[-4],
:author => '' :time => Time.parse(fields[-3]),
:author => ''
})
}) })
})
else else
entries << Entry.new({:name => fields[1], entries << Entry.new(
{
:name => fields[1],
:path => "#{path}/#{fields[1]}", :path => "#{path}/#{fields[1]}",
:kind => 'dir', :kind => 'dir',
:size => nil, :size => nil,
:lastrev => nil :lastrev => nil
}) })
end end
} end
end end
entries.sort_by_name entries.sort_by_name
rescue ScmCommandAborted rescue ScmCommandAborted