rebase: backed out changeset cf8ad0e6c0e4 (issue5610) stable
authorPierre-Yves David <pierre-yves.david@octobus.net>
Tue, 27 Jun 2017 17:40:24 +0200
branchstable
changeset 33121 a5abaa81fad6
parent 33120 b63351f6a246
child 33122 918e7dcf8820
rebase: backed out changeset cf8ad0e6c0e4 (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.
hgext/rebase.py
tests/test-rebase-abort.t
tests/test-rebase-conflicts.t
--- a/hgext/rebase.py	Tue Jun 27 17:39:55 2017 +0200
+++ b/hgext/rebase.py	Tue Jun 27 17:40:24 2017 +0200
@@ -343,7 +343,7 @@
         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 @@
                                              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 @@
             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)
--- a/tests/test-rebase-abort.t	Tue Jun 27 17:39:55 2017 +0200
+++ b/tests/test-rebase-abort.t	Tue Jun 27 17:40:24 2017 +0200
@@ -374,11 +374,10 @@
   $ 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 @@
   parent: 0:df4f53cec30a 
    base
   branch: default
-  commit: 1 unknown (clean)
+  commit: (clean)
   update: 6 new changesets (update)
   phases: 7 draft
 
--- a/tests/test-rebase-conflicts.t	Tue Jun 27 17:39:55 2017 +0200
+++ b/tests/test-rebase-conflicts.t	Tue Jun 27 17:40:24 2017 +0200
@@ -225,6 +225,7 @@
   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 @@
   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 @@
   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