From patchwork Thu Jun 4 23:09:20 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [5,of,6,evolve-ext-V2] evolve: make prune respect allowunsable From: Laurent Charignon X-Patchwork-Id: 9498 Message-Id: <5bb1a7c466988c57ba22.1433459360@lcharignon-mbp.local> To: Date: Thu, 4 Jun 2015 16:09:20 -0700 # HG changeset patch # User Laurent Charignon # Date 1432759785 25200 # Wed May 27 13:49:45 2015 -0700 # Node ID 5bb1a7c466988c57ba224c9aa59b02c4e778b4bd # Parent eb63b8ee80f4d9de5dc61aef279cf3e46a0784f3 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 @@ -1944,6 +1944,14 @@ if not precs: raise util.Abort('nothing to prune') + if not obsolete.isenabled(repo, obsolete.allowunstableopt): + repoheads = repo.changelog.headrevs() + pruneheads = repo.revs("heads(%ld)", precs) + # If a prune head is not a repo head then we will create + # unstability by operating on the midddle of the stack + if not all([h in repoheads for h in pruneheads]): + 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 @@ -1428,3 +1428,15 @@ |/ o 25:4c0bc042ef3b@default(draft) add j1 | + +Check that prune respects the allowunstable option + $ cat >> $HGRCPATH < [experimental] + > evolution=createmarkers + > evolutioncommands=^prune + > EOF + $ hg prune 2b5cbe59aeca + abort: cannot prune in the middle of a stack + [255] + $ hg prune 897e7966b9ef + 1 changesets pruned