Quellcode durchsuchen

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
dnj@chromium.org vor 11 Jahren
Ursprung
Commit
e57a6ebed7
1 geänderte Dateien mit 7 neuen und 0 gelöschten Zeilen
  1. 7 0
      git_number.py

+ 7 - 0
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)