diff options
author | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 00:41:32 +0000 |
---|---|---|
committer | maruel@chromium.org <maruel@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-11 00:41:32 +0000 |
commit | 04a39f7cb4dd6ec3732e5ff9bc561abc1a66baa5 (patch) | |
tree | 5cb648634d4a0bfa47879be88efbd3432eef00e2 /PRESUBMIT.py | |
parent | 430641764227eed23957b1045bd31437599824e4 (diff) | |
download | chromium_src-04a39f7cb4dd6ec3732e5ff9bc561abc1a66baa5.zip chromium_src-04a39f7cb4dd6ec3732e5ff9bc561abc1a66baa5.tar.gz chromium_src-04a39f7cb4dd6ec3732e5ff9bc561abc1a66baa5.tar.bz2 |
Display the actual tree status when the tree is closed. Much more helpful.
TEST=Try committing when the tree is closed to see.
BUG=none
Review URL: http://codereview.chromium.org/119437
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18125 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'PRESUBMIT.py')
-rwxr-xr-x | PRESUBMIT.py | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py index f769350..cbce0b1 100755 --- a/PRESUBMIT.py +++ b/PRESUBMIT.py @@ -58,10 +58,10 @@ def CheckChangeOnCommit(input_api, output_api): input_api, output_api, sources)) # Make sure the tree is 'open'. # TODO(maruel): Run it in a separate thread to parallelize checks? - 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 @@ -109,3 +109,31 @@ def CheckTryJobExecution(input_api, output_api): 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 [] |