Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Unified Diff: PRESUBMIT.py

Issue 119437: Display the actual tree status when the tree is closed. Much more helpful.... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: PRESUBMIT.py
===================================================================
--- PRESUBMIT.py (revision 18080)
+++ PRESUBMIT.py (working copy)
@@ -47,10 +47,10 @@
results.extend(input_api.canned_checks.CheckChangeHasTestField(input_api,
output_api))
# Make sure the tree is 'open'.
- results.extend(input_api.canned_checks.CheckTreeIsOpen(
- input_api, output_api,
- 'http://chromium-status.appspot.com/status', '0'
- ))
+ results.extend(CheckTreeIsOpen(input_api, output_api,
+ 'http://chromium-status.appspot.com/status',
+ '0',
+ 'http://chromium-status.appspot.com/current'))
results.extend(CheckTryJobExecution(input_api, output_api))
return results
@@ -179,3 +179,31 @@
outputs.append(output_api.PresubmitNotifyResult(
'Got %s while looking for try job status.' % str(e)))
return outputs
+
+
+def CheckTreeIsOpen(input_api, output_api, url, closed, url_text):
+ """Similar to the one in presubmit_canned_checks except it shows an helpful
+ status text instead.
+ """
+ assert(input_api.is_committing)
+ try:
+ connection = input_api.urllib2.urlopen(url)
+ status = connection.read()
+ connection.close()
+ if input_api.re.match(closed, status):
+ long_text = status + '\n' + url
+ try:
+ connection = input_api.urllib2.urlopen(url_text)
+ text = connection.read()
+ connection.close()
+ match = input_api.re.search(r"\<div class\=\"Notice\"\>(.*)\<\/div\>",
+ text)
+ if match:
+ long_text = match.group(1).strip()
+ except IOError:
+ pass
+ return [output_api.PresubmitPromptWarning("The tree is closed.",
+ long_text=long_text)]
+ except IOError:
+ pass
+ return []
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698