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
parent eea06ab770
commit 45cba97088
1 changed files with 17 additions and 13 deletions

View File

@ -103,17 +103,19 @@ module Redmine
cmd_args << "-D" << time_to_cvstime(identifier) if identifier
cmd_args << path_with_project
scm_cmd(*cmd_args) do |io|
io.each_line(){|line|
io.each_line() do |line|
fields = line.chop.split('/',-1)
logger.debug(">>InspectLine #{fields.inspect}")
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 => "#{path}/#{fields[-5]}",
:kind => 'file',
:size => nil,
:lastrev => Revision.new({
:lastrev => Revision.new(
{
:revision => fields[-4],
:name => fields[-4],
:time => Time.parse(fields[-3]),
@ -121,14 +123,16 @@ module Redmine
})
})
else
entries << Entry.new({:name => fields[1],
entries << Entry.new(
{
:name => fields[1],
:path => "#{path}/#{fields[1]}",
:kind => 'dir',
:size => nil,
:lastrev => nil
})
end
}
end
end
entries.sort_by_name
rescue ScmCommandAborted