Chromium Code Reviews| Index: verification/tree_status.py |
| =================================================================== |
| --- verification/tree_status.py (revision 234489) |
| +++ verification/tree_status.py (working copy) |
| @@ -7,6 +7,7 @@ |
| import calendar |
| import json |
| import logging |
| +import re |
| import ssl |
| import time |
| import urllib2 |
| @@ -18,12 +19,16 @@ |
| tree_status_url = unicode |
| issue = int |
| last_tree_status = unicode |
| + description = unicode |
| def get_state(self): |
| return base.SUCCEEDED |
| def postpone(self): |
| self.last_tree_status = u'' |
| + if _is_skip_tree_status(self.description): |
| + logging.debug('Skipping tree status check for CL %s' % self.issue) |
| + return False |
| try: |
| logging.debug('Fetching tree status for %s' % self.tree_status_url) |
| now = time.time() |
| @@ -56,6 +61,12 @@ |
| return u'Tree is currently not open: %s' % self.last_tree_status |
| +def _is_skip_tree_status(description): |
| + """Returns True if a description contains NOTREECHECKS=true.""" |
| + match = re.search(r'^NOTREECHECKS=(.*)$', description, re.MULTILINE) |
| + return match and match.group(1).lower() == 'true' |
|
iannucci
2013/11/13 06:24:22
I'm not sure why this function can't be inlined as
rmistry
2013/11/13 19:44:44
No reason, this was just exactly how try_job_on_ri
|
| + |
| + |
| class TreeStatusVerifier(base.Verifier): |
| """Checks the tree status before allowing a commit.""" |
| name = 'tree status' |
| @@ -66,7 +77,8 @@ |
| def verify(self, pending): |
| pending.verifications[self.name] = TreeStatus( |
| - tree_status_url=self.tree_status_url, issue=pending.issue) |
| + tree_status_url=self.tree_status_url, issue=pending.issue, |
| + description=pending.description) |
|
iannucci
2013/11/13 06:24:22
Another way to do it would be to process descripti
iannucci
2013/11/13 06:25:15
Actually... we could just do the description proce
rmistry
2013/11/13 19:44:44
SGTM. Done. PTAL.
|
| def update_status(self, queue): |
| pass |