Commit 72f991f7 authored by Josip Sokcevic's avatar Josip Sokcevic Committed by LUCI CQ

Fix printing error on git-rebase failure

Reverted commit 4511b131 had a bug where
squash_ret.success = True and empty_rebase = False. In that case, stdout
and stderr would already be string and trying to decode would fail.

Bug: 1071280
Change-Id: Iadcc526147ebb98aa7a91a7daa64ef44066e83b6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/tools/depot_tools/+/2163387
Commit-Queue: Edward Lesmes <ehmaldonado@chromium.org>
Auto-Submit: Josip Sokcevic <sokcevic@google.com>
Reviewed-by: 's avatarEdward Lesmes <ehmaldonado@chromium.org>
parent 7a0b07a8
......@@ -662,7 +662,8 @@ def rebase(parent, start, branch, abort=False):
except subprocess2.CalledProcessError as cpe:
if abort:
run_with_retcode('rebase', '--abort') # ignore failure
return RebaseRet(False, cpe.stdout, cpe.stderr)
return RebaseRet(False, cpe.stdout.decode('utf-8', 'replace'),
cpe.stderr.decode('utf-8', 'replace'))
def remove_merge_base(branch):
......@@ -766,7 +767,7 @@ def run_stream_with_retcode(*cmd, **kwargs):
retcode = proc.wait()
if retcode != 0:
raise subprocess2.CalledProcessError(retcode, cmd, os.getcwd(),
None, None)
b'', b'')
def run_with_stderr(*cmd, **kwargs):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment