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