From: Toshi MARUYAMA Date: Fri, 11 Mar 2011 01:48:36 +0000 (+0000) Subject: scm: cvs: code clean up adapter entries(). X-Git-Tag: 1.2.0~756 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=45cba97088a0a8ae9177de39cf9a2c324c4ab9f0;p=redmine.git scm: cvs: code clean up adapter entries(). git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5086 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/scm/adapters/cvs_adapter.rb b/lib/redmine/scm/adapters/cvs_adapter.rb index cc3ebcd2a..12300af7c 100644 --- a/lib/redmine/scm/adapters/cvs_adapter.rb +++ b/lib/redmine/scm/adapters/cvs_adapter.rb @@ -103,32 +103,36 @@ 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| - fields=line.chop.split('/',-1) + 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({ - :revision => fields[-4], - :name => fields[-4], - :time => Time.parse(fields[-3]), - :author => '' + :lastrev => Revision.new( + { + :revision => fields[-4], + :name => fields[-4], + :time => Time.parse(fields[-3]), + :author => '' + }) }) - }) 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