Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # This file is part of Buildbot. Buildbot is free software: you can | 1 # This file is part of Buildbot. Buildbot is free software: you can |
| 2 # redistribute it and/or modify it under the terms of the GNU General Public | 2 # redistribute it and/or modify it under the terms of the GNU General Public |
| 3 # License as published by the Free Software Foundation, version 2. | 3 # License as published by the Free Software Foundation, version 2. |
| 4 # | 4 # |
| 5 # This program is distributed in the hope that it will be useful, but WITHOUT | 5 # This program is distributed in the hope that it will be useful, but WITHOUT |
| 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS | 6 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
| 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more | 7 # FOR A PARTICULAR PURPOSE. See the GNU General Public License for more |
| 8 # details. | 8 # details. |
| 9 # | 9 # |
| 10 # You should have received a copy of the GNU General Public License along with | 10 # You should have received a copy of the GNU General Public License along with |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 if prefix.startswith("/"): | 195 if prefix.startswith("/"): |
| 196 prefix = prefix[1:] | 196 prefix = prefix[1:] |
| 197 log.msg("SVNPoller: svnurl=%s, root=%s, so prefix=%s" % | 197 log.msg("SVNPoller: svnurl=%s, root=%s, so prefix=%s" % |
| 198 (self.svnurl, root, prefix)) | 198 (self.svnurl, root, prefix)) |
| 199 return prefix | 199 return prefix |
| 200 d.addCallback(determine_prefix) | 200 d.addCallback(determine_prefix) |
| 201 return d | 201 return d |
| 202 | 202 |
| 203 def get_logs(self, _): | 203 def get_logs(self, _): |
| 204 args = [] | 204 args = [] |
| 205 args.extend(["log", "--xml", "--verbose", "--non-interactive"]) | 205 args.extend(["log", "--xml", "--verbose", "--non-interactive", |
| 206 "--with-all-revprops"]) | |
|
sadrul
2012/01/26 17:57:49
You suggested in the previous CL for this that thi
M-A Ruel
2012/01/26 18:53:47
Yes, I want you to do the same thing that what is
| |
| 206 if self.svnuser: | 207 if self.svnuser: |
| 207 args.extend(["--username=%s" % self.svnuser]) | 208 args.extend(["--username=%s" % self.svnuser]) |
| 208 if self.svnpasswd: | 209 if self.svnpasswd: |
| 209 args.extend(["--password=%s" % self.svnpasswd]) | 210 args.extend(["--password=%s" % self.svnpasswd]) |
| 210 args.extend(["--limit=%d" % (self.histmax), self.svnurl]) | 211 args.extend(["--limit=%d" % (self.histmax), self.svnurl]) |
| 211 d = self.getProcessOutput(args) | 212 d = self.getProcessOutput(args) |
| 212 return d | 213 return d |
| 213 | 214 |
| 214 def parse_logs(self, output): | 215 def parse_logs(self, output): |
| 215 # parse the XML output, return a list of <logentry> nodes | 216 # parse the XML output, return a list of <logentry> nodes |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 relative_path = path[len(self._prefix):] | 283 relative_path = path[len(self._prefix):] |
| 283 if relative_path.startswith("/"): | 284 if relative_path.startswith("/"): |
| 284 relative_path = relative_path[1:] | 285 relative_path = relative_path[1:] |
| 285 where = self.split_file(relative_path) | 286 where = self.split_file(relative_path) |
| 286 # 'where' is either None or (branch, final_path) | 287 # 'where' is either None or (branch, final_path) |
| 287 return where | 288 return where |
| 288 | 289 |
| 289 def create_changes(self, new_logentries): | 290 def create_changes(self, new_logentries): |
| 290 changes = [] | 291 changes = [] |
| 291 | 292 |
| 293 def commit_bot_used(logentry): | |
| 294 revprops = logentry.getElementsByTagName('revprops') | |
| 295 if revprops is not None: | |
| 296 for revprop in revprops.getElementsByTagName('property'): | |
| 297 if revprop.getAttribute("name") == "commit-bot": | |
| 298 return True | |
| 299 return False | |
| 300 | |
| 292 for el in new_logentries: | 301 for el in new_logentries: |
| 293 revision = str(el.getAttribute("revision")) | 302 revision = str(el.getAttribute("revision")) |
| 294 | 303 |
| 295 revlink='' | 304 revlink='' |
| 296 | 305 |
| 297 if self.revlinktmpl: | 306 if self.revlinktmpl: |
| 298 if revision: | 307 if revision: |
| 299 revlink = self.revlinktmpl % urllib.quote_plus(revision) | 308 revlink = self.revlinktmpl % urllib.quote_plus(revision) |
| 300 | 309 |
| 301 log.msg("Adding change revision %s" % (revision,)) | 310 log.msg("Adding change revision %s" % (revision,)) |
| 302 author = self._get_text(el, "author") | 311 author = self._get_text(el, "author") |
| 303 comments = self._get_text(el, "msg") | 312 comments = self._get_text(el, "msg") |
| 313 used_cq = commit_bot_used(el) | |
| 304 # there is a "date" field, but it provides localtime in the | 314 # there is a "date" field, but it provides localtime in the |
| 305 # repository's timezone, whereas we care about buildmaster's | 315 # repository's timezone, whereas we care about buildmaster's |
| 306 # localtime (since this will get used to position the boxes on | 316 # localtime (since this will get used to position the boxes on |
| 307 # the Waterfall display, etc). So ignore the date field, and | 317 # the Waterfall display, etc). So ignore the date field, and |
| 308 # addChange will fill in with the current time | 318 # addChange will fill in with the current time |
| 309 branches = {} | 319 branches = {} |
| 310 try: | 320 try: |
| 311 pathlist = el.getElementsByTagName("paths")[0] | 321 pathlist = el.getElementsByTagName("paths")[0] |
| 312 except IndexError: # weird, we got an empty revision | 322 except IndexError: # weird, we got an empty revision |
| 313 log.msg("ignoring commit with no paths") | 323 log.msg("ignoring commit with no paths") |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 339 for branch in branches.keys(): | 349 for branch in branches.keys(): |
| 340 action = branches[branch]['action'] | 350 action = branches[branch]['action'] |
| 341 files = branches[branch]['files'] | 351 files = branches[branch]['files'] |
| 342 number_of_files_changed = len(files) | 352 number_of_files_changed = len(files) |
| 343 | 353 |
| 344 if action == u'D' and number_of_files_changed == 1 and files[0] == '': | 354 if action == u'D' and number_of_files_changed == 1 and files[0] == '': |
| 345 log.msg("Ignoring deletion of branch '%s'" % branch) | 355 log.msg("Ignoring deletion of branch '%s'" % branch) |
| 346 else: | 356 else: |
| 347 chdict = dict( | 357 chdict = dict( |
| 348 who=author, | 358 who=author, |
| 359 cq=used_cq, | |
| 349 files=files, | 360 files=files, |
| 350 comments=comments, | 361 comments=comments, |
| 351 revision=revision, | 362 revision=revision, |
| 352 branch=branch, | 363 branch=branch, |
| 353 revlink=revlink, | 364 revlink=revlink, |
| 354 category=self.category, | 365 category=self.category, |
| 355 repository=self.svnurl, | 366 repository=self.svnurl, |
| 356 project = self.project) | 367 project = self.project) |
| 357 changes.append(chdict) | 368 changes.append(chdict) |
| 358 | 369 |
| 359 return changes | 370 return changes |
| 360 | 371 |
| 361 @defer.deferredGenerator | 372 @defer.deferredGenerator |
| 362 def submit_changes(self, changes): | 373 def submit_changes(self, changes): |
| 363 for chdict in changes: | 374 for chdict in changes: |
| 364 wfd = defer.waitForDeferred(self.master.addChange(**chdict)) | 375 wfd = defer.waitForDeferred(self.master.addChange(**chdict)) |
| 365 yield wfd | 376 yield wfd |
| 366 wfd.getResult() | 377 wfd.getResult() |
| 367 | 378 |
| 368 def finished_ok(self, res): | 379 def finished_ok(self, res): |
| 369 if self.cachepath: | 380 if self.cachepath: |
| 370 f = open(self.cachepath, "w") | 381 f = open(self.cachepath, "w") |
| 371 f.write(str(self.last_change)) | 382 f.write(str(self.last_change)) |
| 372 f.close() | 383 f.close() |
| 373 | 384 |
| 374 log.msg("SVNPoller finished polling %s" % res) | 385 log.msg("SVNPoller finished polling %s" % res) |
| 375 return res | 386 return res |
| OLD | NEW |