changeset 2788:554c069cdc85

uncommit: use precheck to validate revision This gives us standard check and standard error message.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Mon, 24 Jul 2017 01:45:17 +0200
parents ebca049e8ca9
children 06ee4ec88190
files hgext3rd/evolve/cmdrewrite.py tests/test-evolve.t tests/test-uncommit.t
diffstat 3 files changed, 7 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/hgext3rd/evolve/cmdrewrite.py	Sun Jul 23 21:20:46 2017 +0200
+++ b/hgext3rd/evolve/cmdrewrite.py	Mon Jul 24 01:45:17 2017 +0200
@@ -266,8 +266,7 @@
         if len(wctx.parents()) > 1:
             raise error.Abort(_("cannot uncommit while merging"))
         old = repo['.']
-        if old.phase() == phases.public:
-            raise error.Abort(_("cannot rewrite immutable changeset"))
+        rewriteutil.precheck(repo, [repo['.'].rev()], action='uncommit')
         if len(old.parents()) > 1:
             raise error.Abort(_("cannot uncommit merge changeset"))
         oldphase = old.phase()
--- a/tests/test-evolve.t	Sun Jul 23 21:20:46 2017 +0200
+++ b/tests/test-evolve.t	Mon Jul 24 01:45:17 2017 +0200
@@ -1280,7 +1280,8 @@
   $ hg up 8dc373be86d9^
   0 files updated, 0 files merged, 2 files removed, 0 files unresolved
   $ hg uncommit --all
-  abort: cannot uncommit in the middle of a stack
+  abort: uncommit will orphan 4 descendants
+  (see 'hg help evolution.instability')
   [255]
   $ hg up 8dc373be86d9
   2 files updated, 0 files merged, 0 files removed, 0 files unresolved
--- a/tests/test-uncommit.t	Sun Jul 23 21:20:46 2017 +0200
+++ b/tests/test-uncommit.t	Mon Jul 24 01:45:17 2017 +0200
@@ -13,7 +13,8 @@
 Cannot uncommit null changeset
 
   $ hg uncommit
-  abort: cannot rewrite immutable changeset
+  abort: cannot uncommit the null revision
+  (no changeset checked out)
   [255]
 
 Cannot uncommit public changeset
@@ -22,7 +23,8 @@
   $ hg ci -Am adda a
   $ hg phase --public .
   $ hg uncommit
-  abort: cannot rewrite immutable changeset
+  abort: cannot uncommit public changesets: 07f494440405
+  (see 'hg help phases' for details)
   [255]
   $ hg phase --force --draft .