prune: test and improve message of immutable aborting. stable
authorPierre-Yves David <pierre-yves.david@ens-lyon.org>
Mon, 04 Feb 2013 22:04:50 +0100
branchstable
changeset 687 6c1fbef2952e
parent 686 d15f8a00e4ce
child 688 f2c3fd21fa63
prune: test and improve message of immutable aborting.
hgext/evolve.py
tests/test-evolve.t
tests/test-prune.t
--- a/hgext/evolve.py	Mon Feb 04 18:44:40 2013 +0100
+++ b/hgext/evolve.py	Mon Feb 04 22:04:50 2013 +0100
@@ -1263,6 +1263,10 @@
         precs = []
         for p in sortedrevs(revs):
             cp = repo[p]
+            if not cp.mutable():
+                # note: create marker would had raise something anyway
+                raise util.Abort('cannot prune immutable changeset: %s' % cp,
+                                 hint='see "hg help phases" for details')
             precs.append(cp)
         if not precs:
             raise util.Abort('nothing to prune')
--- a/tests/test-evolve.t	Mon Feb 04 18:44:40 2013 +0100
+++ b/tests/test-evolve.t	Mon Feb 04 22:04:50 2013 +0100
@@ -58,7 +58,8 @@
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
   1 public stable
   $ hg kill 1
-  abort: cannot obsolete immutable changeset: 7c3bad9141dc
+  abort: cannot prune immutable changeset: 7c3bad9141dc
+  (see "hg help phases" for details)
   [255]
   $ hg log -r 1 --template '{rev} {phase} {obsolete}\n'
   1 public stable
--- a/tests/test-prune.t	Mon Feb 04 18:44:40 2013 +0100
+++ b/tests/test-prune.t	Mon Feb 04 22:04:50 2013 +0100
@@ -62,6 +62,18 @@
   4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
   47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
 
+cannot prune public changesets
+
+  $ hg prune 0
+  abort: cannot prune immutable changeset: 1f0dee641bb7
+  (see "hg help phases" for details)
+  [255]
+  $ hg debugobsolete
+  9d206ffc875e1bc304590549be293be36821e66c 0 {'date': '*', 'user': 'test'} (glob)
+  7c3bad9141dcb46ff89abf5f61856facd56e476c 0 {'date': '*', 'user': 'test'} (glob)
+  4538525df7e2b9f09423636c61ef63a4cb872a2d 0 {'date': '*', 'user': 'test'} (glob)
+  47d2a3944de8b013de3be9578e8e344ea2e6c097 0 {'date': '*', 'user': 'test'} (glob)
+
 Check successors addition
 ----------------------------