Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Unified Diff: git_rebase_update.py

Issue 645763002: Improve error handling in git-rebase-update (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/depot_tools.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « git_common.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: git_rebase_update.py
diff --git a/git_rebase_update.py b/git_rebase_update.py
index aa69fe1fda7fe5498842874ca12e39cd75988081..53e0287dd4663423a7ab8897df27e6aaa19910b0 100755
--- a/git_rebase_update.py
+++ b/git_rebase_update.py
@@ -130,7 +130,8 @@ def rebase_branch(branch, parent, start_hash):
if git.hash_one(parent) != start_hash:
# Try a plain rebase first
print 'Rebasing:', branch
- if not git.rebase(parent, start_hash, branch, abort=True).success:
+ rebase_ret = git.rebase(parent, start_hash, branch, abort=True)
+ if not rebase_ret.success:
# TODO(iannucci): Find collapsible branches in a smarter way?
print "Failed! Attempting to squash", branch, "...",
squash_branch = branch+"_squash_attempt"
@@ -148,14 +149,19 @@ def rebase_branch(branch, parent, start_hash):
git.rebase(parent, start_hash, branch)
else:
# rebase and leave in mid-rebase state.
- git.rebase(parent, start_hash, branch)
+ # This second rebase attempt should always fail in the same
+ # way that the first one does. If it magically succeeds then
+ # something very strange has happened.
+ second_rebase_ret = git.rebase(parent, start_hash, branch)
+ assert(not second_rebase_ret.success)
iannucci 2014/10/13 17:41:39 I would actually throw an AssertionError with the
print "Failed!"
print
- print "Here's what git-rebase had to say:"
- print squash_ret.message
+ print "Here's what git-rebase (squashed) had to say:"
print
+ print squash_ret.stdout
+ print squash_ret.stderr
print textwrap.dedent(
- """
+ """\
Squashing failed. You probably have a real merge conflict.
Your working copy is in mid-rebase. Either:
« no previous file with comments | « git_common.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698