Patchwork D1682: unamend: allow unamending if allowunstable is set

login
register
mail settings
Submitter phabricator
Date Dec. 15, 2017, 6:22 p.m.
Message ID <9dcbb26a34b921249a9080a429cc72d9@localhost.localdomain>
Download mbox | patch
Permalink /patch/26322/
State Not Applicable
Headers show

Comments

phabricator - Dec. 15, 2017, 6:22 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGc1c55291e6ff: unamend: allow unamending if allowunstable is set (authored by martinvonz, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1682?vs=4427&id=4491

REVISION DETAIL
  https://phab.mercurial-scm.org/D1682

AFFECTED FILES
  hgext/uncommit.py
  tests/test-unamend.t

CHANGE DETAILS




To: martinvonz, #hg-reviewers, pulkit
Cc: mercurial-devel

Patch

diff --git a/tests/test-unamend.t b/tests/test-unamend.t
--- a/tests/test-unamend.t
+++ b/tests/test-unamend.t
@@ -280,17 +280,20 @@ 
   o  0:18d04c59bb5d  Added a
   
 
+  $ hg --config experimental.evolution=createmarkers unamend
+  abort: cannot unamend changeset with children
+  [255]
+
   $ hg unamend
-  abort: cannot unamend a changeset with children
-  [255]
 
 Trying to unamend a public changeset
 
-  $ hg up
-  4 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg up -C 23
+  5 files updated, 0 files merged, 0 files removed, 0 files unresolved
   $ hg phase -r . -p
   $ hg unamend
   abort: cannot unamend public changesets
+  (see 'hg help phases' for details)
   [255]
 
 Testing whether unamend retains copies or not
diff --git a/hgext/uncommit.py b/hgext/uncommit.py
--- a/hgext/uncommit.py
+++ b/hgext/uncommit.py
@@ -208,8 +208,7 @@ 
         # identify the commit from which to unamend
         curctx = repo['.']
 
-        if not curctx.mutable():
-            raise error.Abort(_('cannot unamend public changesets'))
+        rewriteutil.precheck(repo, [curctx.rev()], 'unamend')
 
         # identify the commit to which to unamend
         markers = list(predecessormarkers(curctx))
@@ -220,9 +219,6 @@ 
         prednode = markers[0].prednode()
         predctx = unfi[prednode]
 
-        if curctx.children():
-            raise error.Abort(_("cannot unamend a changeset with children"))
-
         # add an extra so that we get a new hash
         # note: allowing unamend to undo an unamend is an intentional feature
         extras = predctx.extra()