Improve error handling in git-rebase-update
Don't discard stderr from failed rebase operations
I had an issue where stdout of the failed rebase was
empty but stderr contained:
First, rewinding head to replay your work on top of it...
Dirty index: cannot apply patches (dirty: internal_gyp
third_party/html_office).
Also, in my case the second rebase was actually succeeding
for some reason, which is clearly no expected, so assert
in this case.
BUG=410339
Review URL: https://codereview.chromium.org/645763002
git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292444 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/git_common.py b/git_common.py
index 99ed53c..7f2e13b 100644
--- a/git_common.py
+++ b/git_common.py
@@ -497,7 +497,7 @@
raise BadCommitRefException(commitrefs)
-RebaseRet = collections.namedtuple('RebaseRet', 'success message')
+RebaseRet = collections.namedtuple('RebaseRet', 'success stdout stderr')
def rebase(parent, start, branch, abort=False):
@@ -521,11 +521,11 @@
if TEST_MODE:
args.insert(0, '--committer-date-is-author-date')
run('rebase', *args)
- return RebaseRet(True, '')
+ return RebaseRet(True, '', '')
except subprocess2.CalledProcessError as cpe:
if abort:
run('rebase', '--abort')
- return RebaseRet(False, cpe.stdout)
+ return RebaseRet(False, cpe.stdout, cpe.stderr)
def remove_merge_base(branch):