From e57a6ebed7c57be51e8b95fb48fd6be896420580 Mon Sep 17 00:00:00 2001 From: "dnj@chromium.org" Date: Tue, 2 Sep 2014 20:49:59 +0000 Subject: [PATCH] Require 'CHROME_HEADLESS' to use 'git-number'. Updated 'git-number' to produce an error message if it's run without the CHROME_HEADLESS (bot) environment variable. This is intended to alert developers who may be incorrectly using this tool to get positioning information instead of the commit position. BUG=409917 TEST=local - Ran with and without 'CHROME_HEADLESS'; observed the error message in the 'without' case. R=iannucci@chromium.org Review URL: https://codereview.chromium.org/534703002 git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291773 0039d316-1c4b-4281-b951-d872f2087c98 --- git_number.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/git_number.py b/git_number.py index 7fa0398af..6997f51b3 100755 --- a/git_number.py +++ b/git_number.py @@ -252,6 +252,13 @@ def main(): # pragma: no cover levels = [logging.ERROR, logging.INFO, logging.DEBUG] logging.basicConfig(level=levels[min(opts.verbose, len(levels) - 1)]) + # 'git number' should only be used on bots. + if os.getenv('CHROME_HEADLESS') != '1': + logging.error("'git-number' is an infrastructure tool that is only " + "intended to be used internally by bots. Developers should " + "use the 'Cr-Commit-Position' value in the commit's message.") + return 1 + try: if opts.reset: clear_caches(on_disk=True)