OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 from buildbot.changes import svnpoller |
| 6 |
| 7 class SVNPoller(svnpoller.SVNPoller): |
| 8 """Adds necessary information to add (CQ) tag to waterfall/console views.""" |
| 9 |
| 10 def get_logs(self, _): |
| 11 """Uses an additional --with-all-revprops argument for svn log so that it |
| 12 has necessary information to know whether a commit was made by the |
| 13 commit-queue.""" |
| 14 args = [] |
| 15 args.extend(["log", "--xml", "--verbose", "--non-interactive", |
| 16 "--with-all-revprops"]) |
| 17 if self.svnuser: |
| 18 args.extend(["--username=%s" % self.svnuser]) |
| 19 if self.svnpasswd: |
| 20 args.extend(["--password=%s" % self.svnpasswd]) |
| 21 args.extend(["--limit=%d" % (self.histmax), self.svnurl]) |
| 22 d = self.getProcessOutput(args) |
| 23 return d |
| 24 |
| 25 def create_changes(self, new_logentries): |
| 26 """Adds a key 'cq' in each change dict. The value is set to ' (CQ)' if the |
| 27 change was committed by the commit-queue.""" |
| 28 def commit_bot_used(logentry): |
| 29 revprops = logentry.getElementsByTagName('revprops') |
| 30 if revprops is not None: |
| 31 for revprop in revprops.getElementsByTagName('property'): |
| 32 if revprop.getAttribute("name") == "commit-bot": |
| 33 return True |
| 34 return False |
| 35 |
| 36 revcq = {} |
| 37 for el in new_logentries: |
| 38 if commit_bot_used(el): |
| 39 revcq[str(el.getAttribute("revision"))] = True |
| 40 |
| 41 changes = svnpoller.SVNPoller.create_changes(self, new_logentries) |
| 42 for change in changes: |
| 43 if change.revision in revcq: |
| 44 change['cq'] = " (CQ)" |
| 45 else: |
| 46 change['cq'] = "" |
| 47 |
| 48 return changes |
OLD | NEW |