Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # -*- test-case-name: buildbot.test.test_svnpoller -*- | 1 # -*- test-case-name: buildbot.test.test_svnpoller -*- |
| 2 | 2 |
| 3 # Based on the work of Dave Peticolas for the P4poll | 3 # Based on the work of Dave Peticolas for the P4poll |
| 4 # Changed to svn (using xml.dom.minidom) by Niklaus Giger | 4 # Changed to svn (using xml.dom.minidom) by Niklaus Giger |
| 5 # Hacked beyond recognition by Brian Warner | 5 # Hacked beyond recognition by Brian Warner |
| 6 | 6 |
| 7 from twisted.python import log | 7 from twisted.python import log |
| 8 from twisted.internet import defer, reactor, utils | 8 from twisted.internet import defer, reactor, utils |
| 9 from twisted.internet.task import LoopingCall | 9 from twisted.internet.task import LoopingCall |
| 10 | 10 |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 (self.svnurl, root)) | 310 (self.svnurl, root)) |
| 311 self._prefix = self.svnurl[len(root):] | 311 self._prefix = self.svnurl[len(root):] |
| 312 if self._prefix.startswith("/"): | 312 if self._prefix.startswith("/"): |
| 313 self._prefix = self._prefix[1:] | 313 self._prefix = self._prefix[1:] |
| 314 log.msg("SVNPoller: svnurl=%s, root=%s, so prefix=%s" % | 314 log.msg("SVNPoller: svnurl=%s, root=%s, so prefix=%s" % |
| 315 (self.svnurl, root, self._prefix)) | 315 (self.svnurl, root, self._prefix)) |
| 316 return self._prefix | 316 return self._prefix |
| 317 | 317 |
| 318 def get_logs(self, ignored_prefix=None): | 318 def get_logs(self, ignored_prefix=None): |
| 319 args = [] | 319 args = [] |
| 320 args.extend(["log", "--xml", "--verbose", "--non-interactive"]) | 320 args.extend(["log", "--xml", "--verbose", "--non-interactive", |
|
M-A Ruel
2011/12/07 17:09:42
Please create a class in scripts/master/ overridin
| |
| 321 "--with-all-revprops"]) | |
| 321 if self.svnuser: | 322 if self.svnuser: |
| 322 args.extend(["--username=%s" % self.svnuser]) | 323 args.extend(["--username=%s" % self.svnuser]) |
| 323 if self.svnpasswd: | 324 if self.svnpasswd: |
| 324 args.extend(["--password=%s" % self.svnpasswd]) | 325 args.extend(["--password=%s" % self.svnpasswd]) |
| 325 args.extend(["--limit=%d" % (self.histmax), self.svnurl]) | 326 args.extend(["--limit=%d" % (self.histmax), self.svnurl]) |
| 326 d = self.getProcessOutput(args) | 327 d = self.getProcessOutput(args) |
| 327 return d | 328 return d |
| 328 | 329 |
| 329 def parse_logs(self, output): | 330 def parse_logs(self, output): |
| 330 # parse the XML output, return a list of <logentry> nodes | 331 # parse the XML output, return a list of <logentry> nodes |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 408 relative_path = path[len(self._prefix):] | 409 relative_path = path[len(self._prefix):] |
| 409 if relative_path.startswith("/"): | 410 if relative_path.startswith("/"): |
| 410 relative_path = relative_path[1:] | 411 relative_path = relative_path[1:] |
| 411 where = self.split_file(relative_path) | 412 where = self.split_file(relative_path) |
| 412 # 'where' is either None or (branch, final_path) | 413 # 'where' is either None or (branch, final_path) |
| 413 return where | 414 return where |
| 414 | 415 |
| 415 def create_changes(self, new_logentries): | 416 def create_changes(self, new_logentries): |
| 416 changes = [] | 417 changes = [] |
| 417 | 418 |
| 419 def commit_bot_used(logentry): | |
| 420 revprops = logentry.getElementsByTagName('revprops') | |
| 421 if revprops is not None: | |
| 422 for revprop in revprops.getElementsByTagName('property'): | |
| 423 if revprop.getAttribute("name") == "commit-bot": | |
| 424 return True | |
| 425 return False | |
| 426 | |
| 418 for el in new_logentries: | 427 for el in new_logentries: |
| 419 branch_files = [] # get oldest change first | 428 branch_files = [] # get oldest change first |
| 420 revision = str(el.getAttribute("revision")) | 429 revision = str(el.getAttribute("revision")) |
| 421 | 430 |
| 422 revlink='' | 431 revlink='' |
| 423 | 432 |
| 424 if self.revlinktmpl: | 433 if self.revlinktmpl: |
| 425 if revision: | 434 if revision: |
| 426 revlink = self.revlinktmpl % urllib.quote_plus(revision) | 435 revlink = self.revlinktmpl % urllib.quote_plus(revision) |
| 427 | 436 |
| 428 dbgMsg("Adding change revision %s" % (revision,)) | 437 dbgMsg("Adding change revision %s" % (revision,)) |
| 429 # TODO: the rest of buildbot may not be ready for unicode 'who' | 438 # TODO: the rest of buildbot may not be ready for unicode 'who' |
| 430 # values | 439 # values |
| 431 author = self._get_text(el, "author") | 440 author = self._get_text(el, "author") |
| 432 comments = self._get_text(el, "msg") | 441 comments = self._get_text(el, "msg") |
| 442 | |
| 443 # If commit-bot was used, then add (CQ) | |
| 444 if commit_bot_used(el): | |
| 445 author += " (CQ)" | |
|
M-A Ruel
2011/12/07 17:09:42
You can't, as this is used to create the blamelist
| |
| 446 | |
| 433 # there is a "date" field, but it provides localtime in the | 447 # there is a "date" field, but it provides localtime in the |
| 434 # repository's timezone, whereas we care about buildmaster's | 448 # repository's timezone, whereas we care about buildmaster's |
| 435 # localtime (since this will get used to position the boxes on | 449 # localtime (since this will get used to position the boxes on |
| 436 # the Waterfall display, etc). So ignore the date field and use | 450 # the Waterfall display, etc). So ignore the date field and use |
| 437 # our local clock instead. | 451 # our local clock instead. |
| 438 #when = self._get_text(el, "date") | 452 #when = self._get_text(el, "date") |
| 439 #when = time.mktime(time.strptime("%.19s" % when, | 453 #when = time.mktime(time.strptime("%.19s" % when, |
| 440 # "%Y-%m-%dT%H:%M:%S")) | 454 # "%Y-%m-%dT%H:%M:%S")) |
| 441 branches = {} | 455 branches = {} |
| 442 pathlist = el.getElementsByTagName("paths")[0] | 456 pathlist = el.getElementsByTagName("paths")[0] |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 assert self.working | 506 assert self.working |
| 493 self.working = False | 507 self.working = False |
| 494 return res | 508 return res |
| 495 | 509 |
| 496 def finished_failure(self, f): | 510 def finished_failure(self, f): |
| 497 log.msg("SVNPoller failed") | 511 log.msg("SVNPoller failed") |
| 498 dbgMsg('_finished : %s' % f) | 512 dbgMsg('_finished : %s' % f) |
| 499 assert self.working | 513 assert self.working |
| 500 self.working = False | 514 self.working = False |
| 501 return None # eat the failure | 515 return None # eat the failure |
| OLD | NEW |