mirror of
https://chromium.googlesource.com/chromium/tools/depot_tools.git
synced 2026-01-11 18:51:29 +00:00
git-cl: catch "ReAuth is required" error and re-raise is properly
This CL updates _RunGitPushWithTraces to detect git credential-luci "ReAuth is required" error and propagate it nicely to the caller. Previously, the error is uncaught, and re-raised with nested exception stacktrace. The result was an unhelpful traceback, where the true error is at the top (part of git push stdout/stderr). This CL now propagate the error with a clear GitPushError printed last (which hopefully gets developer's attention). Fixed: 445532843 Change-Id: I789a6902b59af2c9df92fc7d013829afc4154dc1 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/6954695 Commit-Queue: Scott Lee <ddoman@chromium.org> Reviewed-by: Allen Li <ayatane@chromium.org> Auto-Submit: Jiewei Qian <qjw@chromium.org> Reviewed-by: Scott Lee <ddoman@chromium.org>
This commit is contained in:
15
git_cl.py
15
git_cl.py
@@ -3103,7 +3103,20 @@ class Changelist(object):
|
||||
'git cl upload -o nokeycheck\n\n'
|
||||
'If git-cl is not working correctly, file a bug under the '
|
||||
'Infra>SDK component.')
|
||||
|
||||
if 'git credential-luci reauth' in str(e.stdout):
|
||||
raise GitPushError(
|
||||
'Failed to upload a change: ReAuth is required.\n'
|
||||
'\n'
|
||||
'Please ReAuth by running:\n'
|
||||
' git credential-luci reauth\n'
|
||||
'\n'
|
||||
'If you are having trouble with ReAuth, see:\n'
|
||||
'https://chromium.googlesource.com/chromium/src/+/main/docs/gerrit_reauth.md\n'
|
||||
'\n'
|
||||
'To bypass ReAuth for now, set LUCI_BYPASS_REAUTH '
|
||||
'environment variable, then try again:\n'
|
||||
' On Linux/Mac: export LUCI_BYPASS_REAUTH=1\n'
|
||||
' On Windows: set LUCI_BYPASS_REAUTH=1\n')
|
||||
raise GitPushError(
|
||||
'Failed to create a change. Please examine output above for the '
|
||||
'reason of the failure.\n'
|
||||
|
||||
Reference in New Issue
Block a user