[PATCH 1 of 2 evolve-ext-V4] evolve: make prune respect allowunsable

Laurent Charignon lcharignon at fb.com
Wed Jun 17 20:39:40 UTC 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1432759785 25200
#      Wed May 27 13:49:45 2015 -0700
# Node ID adb791429c95d8ca9df9fa427b97afae14ebfc6e
# Parent  c02cdb97ebfa29c0df40417db9e36f31f2977b4b
evolve: make prune respect allowunsable

Before this patch, the prune command was performing the same way regardless
of the value of experimental.evolution.
With this patch if the configuration does not allow unstability, prune won't
create instability.

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -1928,6 +1928,10 @@ def cmdprune(ui, repo, *revs, **opts):
         if not precs:
             raise util.Abort('nothing to prune')
 
+        if not obsolete.isenabled(repo, obsolete.allowunstableopt):
+            if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0:
+                raise util.Abort(_("cannot prune in the middle of a stack"))
+
         # defines successors changesets
         sucs = scmutil.revrange(repo, succs)
         sucs.sort()
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1302,3 +1302,17 @@ With only createmarkers we can only unco
   |/
   o  25:4c0bc042ef3b at default(draft) add j1
   |
+
+Check that prune respects the allowunstable option
+  $ hg prune 2b5cbe59aeca
+  abort: cannot prune in the middle of a stack
+  [255]
+  $ hg up 07aaa06da467
+  3 files updated, 0 files merged, 3 files removed, 0 files unresolved
+  $ mkcommit c5_
+  created new head
+  $ hg prune '897e7966b9ef + 07aaa06da467'
+  abort: cannot prune in the middle of a stack
+  [255]
+  $ hg prune 897e7966b9ef
+  1 changesets pruned


More information about the Mercurial-devel mailing list