rebase: continue abort without strip for immutable csets (issue3997) stable
authorMatt Mackall <mpm@selenic.com>
Thu, 01 Aug 2013 17:45:13 -0500
branchstable
changeset 19517 eab2ff59481e
parent 19516 fe78eb7bcca0
child 19518 12843143663d
rebase: continue abort without strip for immutable csets (issue3997) This causes us to simply discard the rebase state.
hgext/rebase.py
tests/test-rebase-interruptions.t
--- a/hgext/rebase.py	Thu Aug 01 17:33:09 2013 -0500
+++ b/hgext/rebase.py	Thu Aug 01 17:45:13 2013 -0500
@@ -609,9 +609,9 @@
     dstates = [s for s in state.values() if s != nullrev]
     immutable = [d for d in dstates if not repo[d].mutable()]
     if immutable:
-        raise util.Abort(_("can't abort rebase due to immutable changesets %s")
-                         % ', '.join(str(repo[r]) for r in immutable),
-                         hint=_('see hg help phases for details'))
+        repo.ui.warn(_("warning: can't clean up immutable changesets %s\n")
+                     % ', '.join(str(repo[r]) for r in immutable),
+                     hint=_('see hg help phases for details'))
 
     descendants = set()
     if dstates:
@@ -622,12 +622,12 @@
         return -1
     else:
         # Update away from the rebase if necessary
-        if inrebase(repo, originalwd, state):
+        if not immutable and inrebase(repo, originalwd, state):
             merge.update(repo, repo[originalwd].rev(), False, True, False)
 
         # Strip from the first rebased revision
         rebased = filter(lambda x: x > -1 and x != target, state.values())
-        if rebased:
+        if rebased and not immutable:
             strippoints = [c.node()  for c in repo.set('roots(%ld)', rebased)]
             # no backup of rebased cset versions needed
             repair.strip(repo.ui, repo, strippoints)
--- a/tests/test-rebase-interruptions.t	Thu Aug 01 17:33:09 2013 -0500
+++ b/tests/test-rebase-interruptions.t	Thu Aug 01 17:45:13 2013 -0500
@@ -248,9 +248,8 @@
 Abort the rebasing:
 
   $ hg rebase --abort
-  abort: can't abort rebase due to immutable changesets 45396c49d53b
-  (see hg help phases for details)
-  [255]
+  warning: can't clean up immutable changesets 45396c49d53b
+  rebase aborted
 
   $ hg tglogp
   @  5:public 'B'