##// END OF EJS Templates
scm: cvs: code clean up....
Toshi MARUYAMA -
r4684:40b953f05a18
parent child
Show More
@@ -55,7 +55,7 module Redmine
55 55 def get_previous_revision(revision)
56 56 CvsRevisionHelper.new(revision).prevRev
57 57 end
58
58
59 59 # Returns an Entries collection
60 60 # or nil if the given path doesn't exist in the repository
61 61 # this method is used by the repository-browser (aka LIST)
@@ -70,7 +70,7 module Redmine
70 70 io.each_line(){|line|
71 71 fields=line.chop.split('/',-1)
72 72 logger.debug(">>InspectLine #{fields.inspect}")
73
73
74 74 if fields[0]!="D"
75 75 entries << Entry.new({:name => fields[-5],
76 76 #:path => fields[-4].include?(path)?fields[-4]:(path + "/"+ fields[-4]),
@@ -96,17 +96,17 module Redmine
96 96 end
97 97 return nil if $? && $?.exitstatus != 0
98 98 entries.sort_by_name
99 end
99 end
100 100
101 101 STARTLOG="----------------------------"
102 102 ENDLOG ="============================================================================="
103
103
104 104 # Returns all revisions found between identifier_from and identifier_to
105 105 # in the repository. both identifier have to be dates or nil.
106 106 # these method returns nothing but yield every result in block
107 107 def revisions(path=nil, identifier_from=nil, identifier_to=nil, options={}, &block)
108 108 logger.debug "<cvs> revisions path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
109
109
110 110 path_with_project="#{url}#{with_leading_slash(path)}"
111 111 cmd = "#{CVS_BIN} -d #{shell_quote root_url} rlog"
112 112 cmd << " -d\">#{time_to_cvstime_rlog(identifier_from)}\"" if identifier_from
@@ -123,7 +123,7 module Redmine
123 123 file_state=nil
124 124 branch_map=nil
125 125
126 io.each_line() do |line|
126 io.each_line() do |line|
127 127
128 128 if state!="revision" && /^#{ENDLOG}/ =~ line
129 129 commit_log=String.new
@@ -162,9 +162,9 module Redmine
162 162 end
163 163 next
164 164 elsif state=="revision"
165 if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line
165 if /^#{ENDLOG}/ =~ line || /^#{STARTLOG}/ =~ line
166 166 if revision
167
167
168 168 revHelper=CvsRevisionHelper.new(revision)
169 169 revBranch="HEAD"
170 170
@@ -176,7 +176,7 module Redmine
176 176
177 177 logger.debug("********** YIELD Revision #{revision}::#{revBranch}")
178 178
179 yield Revision.new({
179 yield Revision.new({
180 180 :time => date,
181 181 :author => author,
182 182 :message=>commit_log.chomp,
@@ -188,9 +188,9 module Redmine
188 188 :kind=>'file',
189 189 :action=>file_state
190 190 }]
191 })
191 })
192 192 end
193
193
194 194 commit_log=String.new
195 195 revision=nil
196 196
@@ -199,7 +199,7 module Redmine
199 199 end
200 200 next
201 201 end
202
202
203 203 if /^branches: (.+)$/ =~ line
204 204 #TODO: version.branch = $1
205 205 elsif /^revision (\d+(?:\.\d+)+).*$/ =~ line
@@ -216,16 +216,16 module Redmine
216 216 # version.line_minus = linechanges[2]
217 217 # else
218 218 # version.line_plus = 0
219 # version.line_minus = 0
220 # end
221 else
219 # version.line_minus = 0
220 # end
221 else
222 222 commit_log << line unless line =~ /^\*\*\* empty log message \*\*\*/
223 end
224 end
223 end
224 end
225 225 end
226 226 end
227 end
228
227 end
228
229 229 def diff(path, identifier_from, identifier_to=nil)
230 230 logger.debug "<cvs> diff path:'#{path}',identifier_from #{identifier_from}, identifier_to #{identifier_to}"
231 231 path_with_project="#{url}#{with_leading_slash(path)}"
@@ -238,8 +238,8 module Redmine
238 238 end
239 239 return nil if $? && $?.exitstatus != 0
240 240 diff
241 end
242
241 end
242
243 243 def cat(path, identifier=nil)
244 244 identifier = (identifier) ? identifier : "HEAD"
245 245 logger.debug "<cvs> cat path:'#{path}',identifier #{identifier}"
@@ -253,7 +253,7 module Redmine
253 253 end
254 254 return nil if $? && $?.exitstatus != 0
255 255 cat
256 end
256 end
257 257
258 258 def annotate(path, identifier=nil)
259 259 identifier = (identifier) ? identifier.to_i : "HEAD"
@@ -270,9 +270,9 module Redmine
270 270 return nil if $? && $?.exitstatus != 0
271 271 blame
272 272 end
273
273
274 274 private
275
275
276 276 # Returns the root url without the connexion string
277 277 # :pserver:anonymous@foo.bar:/path => /path
278 278 # :ext:cvsservername:/path => /path
General Comments 0
You need to be logged in to leave comments. Login now