rebase: backed out changeset 507f16f4aa51 (issue5610)

Having a single transaction for rebase means the whole transaction gets rolled back
on error. To work around this a small hack has been added to detect merge
conflict and commit the work done so far before exiting. This hack works because
there is nothing transaction related going on during the merge phase.

However, if a hook blocks the rebase to create a changeset, it is too late to commit the
work done in the transaction before the problematic changeset was created. This
leads to the whole rebase so far being rolled back. Losing merge resolution and
other work in the process. (note: rebase state will be fully lost too).

Since issue5610 is a pretty serious regression and the next stable release is a
couple day away, we are taking the backout route until we can figure out
something better to do.
This commit is contained in:
Pierre-Yves David 2017-06-27 17:40:24 +02:00
parent 70672e4541
commit 17353b92ba
3 changed files with 7 additions and 12 deletions

View File

@ -343,7 +343,7 @@ class rebaseruntime(object):
if dest.closesbranch() and not self.keepbranchesf:
self.ui.status(_('reopening closed branch head %s\n') % dest)
def _performrebase(self, tr):
def _performrebase(self):
repo, ui, opts = self.repo, self.ui, self.opts
if self.keepbranchesf:
# insert _savebranch at the start of extrafns so if
@ -393,7 +393,7 @@ class rebaseruntime(object):
self.state,
self.targetancestors,
self.obsoletenotrebased)
self.storestatus(tr=tr)
self.storestatus()
storecollapsemsg(repo, self.collapsemsg)
if len(repo[None].parents()) == 2:
repo.ui.debug('resuming interrupted rebase\n')
@ -721,12 +721,7 @@ def rebase(ui, repo, **opts):
if retcode is not None:
return retcode
with repo.transaction('rebase') as tr:
try:
rbsrt._performrebase(tr)
except error.InterventionRequired:
tr.close()
raise
rbsrt._performrebase()
rbsrt._finishrebase()
finally:
release(lock, wlock)

View File

@ -374,11 +374,10 @@ test aborting an interrupted series (issue5084)
$ hg --config extensions.n=$TESTDIR/failfilemerge.py rebase -s 3 -d tip
rebasing 3:3a71550954f1 "b"
rebasing 4:e80b69427d80 "c"
transaction abort!
rollback completed
abort: ^C
[255]
$ hg rebase --abort
saved backup bundle to $TESTTMP/interrupted/.hg/strip-backup/3d8812cf300d-93041a90-backup.hg (glob)
rebase aborted
$ hg log -G --template "{rev} {desc} {bookmarks}"
o 6 no-a
@ -399,7 +398,7 @@ test aborting an interrupted series (issue5084)
parent: 0:df4f53cec30a
base
branch: default
commit: 1 unknown (clean)
commit: (clean)
update: 6 new changesets (update)
phases: 7 draft

View File

@ -225,6 +225,7 @@ Check that the right ancestors is used while rebasing a merge (issue4041)
ignoring null merge rebase of 8
rebasing 9:e31216eec445 "more changes to f1"
future parents are 2 and -1
rebase status stored
update to 2:4bc80088dc6b
resolving manifests
branchmerge: False, force: True, partial: False
@ -250,6 +251,7 @@ Check that the right ancestors is used while rebasing a merge (issue4041)
rebased as 19c888675e13
rebasing 10:2f2496ddf49d "merge" (tip)
future parents are 11 and 7
rebase status stored
already in target
merge against 10:2f2496ddf49d
detach base 9:e31216eec445
@ -267,7 +269,6 @@ Check that the right ancestors is used while rebasing a merge (issue4041)
committing changelog
rebased as 2a7f09cac94c
rebase merging completed
rebase status stored
update back to initial working directory parent
resolving manifests
branchmerge: False, force: False, partial: False