Print branch name when running presubmits

This implements the proposed solution B in https://crbug.com/380877175#comment5
and will help distinguish presubmit results when working with stacked changes.

Bug: 380877175
Change-Id: I7f0807f7ce03109288976069c57c28488d6cadfd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6196130
Reviewed-by: Yiwei Zhang <yiwzhang@google.com>
Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
Gavin Mak
2025-01-24 14:15:15 -08:00
committed by LUCI CQ
parent 8c858fc98c
commit 77a800d729
2 changed files with 9 additions and 4 deletions

View File

@@ -1922,10 +1922,14 @@ def DoPresubmitChecks(change,
1 if presubmit checks failed or 0 otherwise.
"""
with setup_environ({'PYTHONDONTWRITEBYTECODE': '1'}):
if committing:
sys.stdout.write('Running presubmit commit checks ...\n')
else:
sys.stdout.write('Running presubmit upload checks ...\n')
running_msg = 'Running presubmit '
running_msg += 'commit ' if committing else 'upload '
running_msg += 'checks '
if branch := scm.GIT.GetBranch(change.RepositoryRoot()):
running_msg += f'on branch {branch} '
running_msg += '...\n'
sys.stdout.write(running_msg)
start_time = time_time()
presubmit_files = ListRelevantPresubmitFiles(
change.AbsoluteLocalPaths() + change.AbsoluteLocalSubmodules(),