aboutsummaryrefslogtreecommitdiffhomepage
path: root/PRESUBMIT.py
diff options
context:
space:
mode:
authorGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-12 19:45:46 +0000
committerGravatar rmistry@google.com <rmistry@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81>2013-04-12 19:45:46 +0000
commit547012dc05dd3af503624bb9c72b56e898bc4b64 (patch)
tree93a1113be086a80eee29ea22bcc656e887daa70a /PRESUBMIT.py
parentc518710d9a99c4d0adf759a102f4a1cb582f5939 (diff)
If the tree is closed then print information about contacting the sheriff.
The motivation for this CL is because it is not very obvious on how to submit when tree is closed in git. Also added a section 'How to submit when tree is closed' in https://sites.google.com/site/skiadocs/developer-documentation/tree-sheriff (SkipBuildbotRuns) Review URL: https://codereview.chromium.org/13932026 git-svn-id: http://skia.googlecode.com/svn/trunk@8666 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'PRESUBMIT.py')
-rw-r--r--PRESUBMIT.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index 323bba9074..e46f91ebfe 100644
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -13,6 +13,9 @@ import os
import sys
+SKIA_TREE_STATUS_URL = 'http://skia-tree-status.appspot.com'
+
+
def _CheckChangeHasEol(input_api, output_api, source_file_filter=None):
"""Checks that files end with atleast one \n (LF)."""
eof_files = []
@@ -80,6 +83,16 @@ def _CheckTreeStatus(input_api, output_api, json_url):
tree_status_results.append(
output_api.PresubmitPromptWarning(
message=short_text, long_text=long_text))
+ else:
+ # Tree status is closed. Put in message about contacting sheriff.
+ connection = input_api.urllib2.urlopen(
+ SKIA_TREE_STATUS_URL + '/current-sheriff')
+ sheriff_details = input_api.json.loads(connection.read())
+ if sheriff_details:
+ tree_status_results[0]._message += (
+ '\n\nPlease contact the current Skia sheriff (%s) if you are trying '
+ 'to submit a build fix\nand do not know how to submit because the '
+ 'tree is closed') % sheriff_details['username']
return tree_status_results
@@ -96,5 +109,5 @@ def CheckChangeOnCommit(input_api, output_api):
results.extend(_CommonChecks(input_api, output_api))
results.extend(
_CheckTreeStatus(input_api, output_api, json_url=(
- 'http://skia-tree-status.appspot.com/banner-status?format=json')))
+ SKIA_TREE_STATUS_URL + '/banner-status?format=json')))
return results