From 547012dc05dd3af503624bb9c72b56e898bc4b64 Mon Sep 17 00:00:00 2001 From: "rmistry@google.com" Date: Fri, 12 Apr 2013 19:45:46 +0000 Subject: [PATCH] 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 --- PRESUBMIT.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/PRESUBMIT.py b/PRESUBMIT.py index 323bba9..e46f91e 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 -- 2.7.4