Detect uploadvalidator error message
If git push refs/for/ errors out, inspect stdout message to detect
uploadvalidator rejection. If present, present user a solution.
R=ajp@google.com
Change-Id: I70aee7615f3d905127a31bd5679968ade75c234a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2888475
Reviewed-by: Andy Perelson <ajp@chromium.org>
Commit-Queue: Josip Sokcevic <sokcevic@google.com>
diff --git a/gclient_utils.py b/gclient_utils.py
index 65223a7..fb67708 100644
--- a/gclient_utils.py
+++ b/gclient_utils.py
@@ -585,6 +585,10 @@
sleep_interval = RETRY_INITIAL_SLEEP
run_cwd = kwargs.get('cwd', os.getcwd())
+
+ # Store the output of the command regardless of the value of print_stdout or
+ # filter_fn.
+ command_output = io.BytesIO()
for attempt in range(RETRY_MAX + 1):
# If our stdout is a terminal, then pass in a psuedo-tty pipe to our
# subprocess when filtering its output. This makes the subproc believe
@@ -603,10 +607,6 @@
GClientChildren.add(kid)
- # Store the output of the command regardless of the value of print_stdout or
- # filter_fn.
- command_output = io.BytesIO()
-
# Passed as a list for "by ref" semantics.
needs_header = [show_header]
if always_show_header:
@@ -667,11 +667,12 @@
print("WARNING: subprocess '%s' in %s failed; will retry after a short "
'nap...' % (' '.join('"%s"' % x for x in args), run_cwd))
+ command_output = io.BytesIO()
time.sleep(sleep_interval)
sleep_interval *= 2
raise subprocess2.CalledProcessError(
- rv, args, kwargs.get('cwd', None), None, None)
+ rv, args, kwargs.get('cwd', None), command_output.getvalue(), None)
class GitFilter(object):