From 37a737c1bc8e16cf70212d73466ccca872068dba Mon Sep 17 00:00:00 2001 From: Gavin Mak Date: Thu, 15 Aug 2024 16:37:54 +0000 Subject: [PATCH] Update presubmit feedback message for Cog We shouldn't be suggesting people run unsupported commands on cog. Change-Id: I0a15b825b32a3f9bc40c65e0b51be33f06de54ad Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/5782965 Auto-Submit: Gavin Mak Commit-Queue: Gavin Mak Reviewed-by: Yiwei Zhang --- presubmit_support.py | 15 +++++++++++---- tests/presubmit_unittest.py | 2 +- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/presubmit_support.py b/presubmit_support.py index cbdd9d2a5..04b1d0f1f 100755 --- a/presubmit_support.py +++ b/presubmit_support.py @@ -2020,11 +2020,18 @@ def DoPresubmitChecks(change, global _ASKED_FOR_FEEDBACK # Ask for feedback one time out of 5. if (results and random.randint(0, 4) == 0 and not _ASKED_FOR_FEEDBACK): - sys.stdout.write( - 'Was the presubmit check useful? If not, run "git cl presubmit -v"\n' - 'to figure out which PRESUBMIT.py was run, then run git blame\n' - 'on the file to figure out who to ask for help.\n') _ASKED_FOR_FEEDBACK = True + if gclient_utils.IsEnvCog(): + sys.stdout.write( + 'Was the presubmit check useful? If not, view the file\'s\n' + 'blame on Code Search to figure out who to ask for help.\n') + else: + sys.stdout.write( + 'Was the presubmit check useful? If not, run ' + '"git cl presubmit -v"\n' + 'to figure out which PRESUBMIT.py was run, then run ' + '"git blame"\n' + 'on the file to figure out who to ask for help.\n') return 1 if presubmits_failed else 0 diff --git a/tests/presubmit_unittest.py b/tests/presubmit_unittest.py index 7becaeb1c..ab5a75bc5 100755 --- a/tests/presubmit_unittest.py +++ b/tests/presubmit_unittest.py @@ -888,7 +888,7 @@ def CheckChangeOnCommit(input_api, output_api): '** Presubmit ERRORS: 1 **\n!!\n\n' 'There were Python 3 presubmit errors.\n' 'Was the presubmit check useful? If not, run "git cl presubmit -v"\n' - 'to figure out which PRESUBMIT.py was run, then run git blame\n' + 'to figure out which PRESUBMIT.py was run, then run "git blame"\n' 'on the file to figure out who to ask for help.\n') self.assertEqual(sys.stdout.getvalue(), text)