##// END OF EJS Templates
scm: cvs: code clean up adapter entries()....
Toshi MARUYAMA -
r4966:45cba97088a0
parent child
Show More
@@ -103,32 +103,36 module Redmine
103 cmd_args << "-D" << time_to_cvstime(identifier) if identifier
103 cmd_args << "-D" << time_to_cvstime(identifier) if identifier
104 cmd_args << path_with_project
104 cmd_args << path_with_project
105 scm_cmd(*cmd_args) do |io|
105 scm_cmd(*cmd_args) do |io|
106 io.each_line(){|line|
106 io.each_line() do |line|
107 fields=line.chop.split('/',-1)
107 fields = line.chop.split('/',-1)
108 logger.debug(">>InspectLine #{fields.inspect}")
108 logger.debug(">>InspectLine #{fields.inspect}")
109
110 if fields[0]!="D"
109 if fields[0]!="D"
111 entries << Entry.new({:name => fields[-5],
110 entries << Entry.new(
111 {
112 :name => fields[-5],
112 #:path => fields[-4].include?(path)?fields[-4]:(path + "/"+ fields[-4]),
113 #:path => fields[-4].include?(path)?fields[-4]:(path + "/"+ fields[-4]),
113 :path => "#{path}/#{fields[-5]}",
114 :path => "#{path}/#{fields[-5]}",
114 :kind => 'file',
115 :kind => 'file',
115 :size => nil,
116 :size => nil,
116 :lastrev => Revision.new({
117 :lastrev => Revision.new(
117 :revision => fields[-4],
118 {
118 :name => fields[-4],
119 :revision => fields[-4],
119 :time => Time.parse(fields[-3]),
120 :name => fields[-4],
120 :author => ''
121 :time => Time.parse(fields[-3]),
122 :author => ''
123 })
121 })
124 })
122 })
123 else
125 else
124 entries << Entry.new({:name => fields[1],
126 entries << Entry.new(
127 {
128 :name => fields[1],
125 :path => "#{path}/#{fields[1]}",
129 :path => "#{path}/#{fields[1]}",
126 :kind => 'dir',
130 :kind => 'dir',
127 :size => nil,
131 :size => nil,
128 :lastrev => nil
132 :lastrev => nil
129 })
133 })
130 end
134 end
131 }
135 end
132 end
136 end
133 entries.sort_by_name
137 entries.sort_by_name
134 rescue ScmCommandAborted
138 rescue ScmCommandAborted
General Comments 0
You need to be logged in to leave comments. Login now