Commit 8b4900e7 authored by sbc@chromium.org's avatar sbc@chromium.org

Handle unusual case in rebase-update where second rebase attempt works.

Previously we just added an assert here but better
to simply succeed in this case, while outputting
the intial failure message.

BUG=425696

Review URL: https://codereview.chromium.org/667793005

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@292687 0039d316-1c4b-4281-b951-d872f2087c98
parent 9c99943d
...@@ -83,7 +83,6 @@ def main(argv): ...@@ -83,7 +83,6 @@ def main(argv):
assert svn_repo is not None, 'Unable to find svn repo for %s' % match.group(1) assert svn_repo is not None, 'Unable to find svn repo for %s' % match.group(1)
print 'Found upstream svn repo %s and path %s' % (svn_repo, svn_path) print 'Found upstream svn repo %s and path %s' % (svn_repo, svn_path)
prefix = upstream.rsplit('/')[0]
set_config('svn-remote.svn.url', svn_repo) set_config('svn-remote.svn.url', svn_repo)
set_config('svn-remote.svn.fetch', set_config('svn-remote.svn.fetch',
'%s:refs/remotes/%s' % (svn_path, upstream)) '%s:refs/remotes/%s' % (svn_path, upstream))
......
...@@ -148,30 +148,36 @@ def rebase_branch(branch, parent, start_hash): ...@@ -148,30 +148,36 @@ def rebase_branch(branch, parent, start_hash):
git.squash_current_branch(merge_base=start_hash) git.squash_current_branch(merge_base=start_hash)
git.rebase(parent, start_hash, branch) git.rebase(parent, start_hash, branch)
else: else:
print "Failed!"
print
# rebase and leave in mid-rebase state. # rebase and leave in mid-rebase state.
# This second rebase attempt should always fail in the same # This second rebase attempt should always fail in the same
# way that the first one does. If it magically succeeds then # way that the first one does. If it magically succeeds then
# something very strange has happened. # something very strange has happened.
second_rebase_ret = git.rebase(parent, start_hash, branch) second_rebase_ret = git.rebase(parent, start_hash, branch)
assert(not second_rebase_ret.success) if second_rebase_ret.success: # pragma: no cover
print "Failed!" print "Second rebase succeeded unexpectedly!"
print print "Please see: http://crbug.com/425696"
print "Here's what git-rebase (squashed) had to say:" print "First rebased failed with:"
print print rebase_ret.stderr
print squash_ret.stdout else:
print squash_ret.stderr print "Here's what git-rebase (squashed) had to say:"
print textwrap.dedent( print
"""\ print squash_ret.stdout
Squashing failed. You probably have a real merge conflict. print squash_ret.stderr
print textwrap.dedent(
Your working copy is in mid-rebase. Either: """\
* completely resolve like a normal git-rebase; OR Squashing failed. You probably have a real merge conflict.
* abort the rebase and mark this branch as dormant:
git config branch.%s.dormant true Your working copy is in mid-rebase. Either:
* completely resolve like a normal git-rebase; OR
And then run `git rebase-update` again to resume. * abort the rebase and mark this branch as dormant:
""" % branch) git config branch.%s.dormant true
return False
And then run `git rebase-update` again to resume.
""" % branch)
return False
else: else:
print '%s up-to-date' % branch print '%s up-to-date' % branch
......
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