From 912a744103664d7fe0e8b75b7ebb4a49f90c58c7 Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Thu, 6 Feb 2025 09:43:28 -0800 Subject: [PATCH] Add next steps to 'git cl presubmit' cog error message This updates the presubmit error message when running on Cog to include instructions on how to trigger presubmits. This also standardizes the messaging across git cl presubmit/web/presubmit. Bug: 394615879 Change-Id: Iaa8857268cd43219f7502eb34388034890a919dc Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6240212 Reviewed-by: Andy Perelson Commit-Queue: Gavin Mak Reviewed-by: Yiwei Zhang --- git_cl.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/git_cl.py b/git_cl.py index 5c1c7a1fd..9a79ad276 100755 --- a/git_cl.py +++ b/git_cl.py @@ -5024,9 +5024,10 @@ def CMDlint(parser, args): def CMDpresubmit(parser, args): """Runs presubmit tests on the current changelist.""" if gclient_utils.IsEnvCog(): - # TODO - crbug/336555565: give user more instructions on how to - # trigger presubmit in Cog once the UX is finalized. - print('presubmit command is not supported in non-git environment.', + print('presubmit command is not supported in non-git environment. ' + 'Please use the "Chromium PRESUBMITS" panel or the "Run ' + 'Presubmit Checks" command in the command palette in the editor ' + 'instead.', file=sys.stderr) return 1 parser.add_option('-u', @@ -6308,9 +6309,9 @@ def CMDweb(parser, args): """Opens the current CL in the web browser.""" if gclient_utils.IsEnvCog(): print( - 'web command is not supported. Please use "Gerrit: Open Changes ' - 'in Gerrit" functionality in the command palette in the Editor ' - 'instead.', + 'web command is not supported in non-git environment. Please use ' + '"Gerrit: Open Changes in Gerrit" functionality in the command ' + 'palette in the editor instead.', file=sys.stderr) return 1 @@ -6958,9 +6959,9 @@ def CMDformat(parser, args): """Runs auto-formatting tools (clang-format etc.) on the diff.""" if gclient_utils.IsEnvCog(): print( - 'format command is not supported. Please use the "Format ' - 'Modified Lines in All Files (git cl format)" functionality in' - 'command palette in the editor instead.', + 'format command is not supported in non-git environment. Please ' + 'use the "Format Modified Lines in All Files (git cl format)" ' + 'functionality in the command palette in the editor instead.', file=sys.stderr) return 1 clang_exts = ['.cc', '.cpp', '.h', '.m', '.mm', '.proto']