# HG changeset patch # User Laurent Charignon # Date 1434737031 25200 # Node ID 35f2f54b557c1181865653eb1fb2b9c0420080ba # Parent ba95cec18fe9c809814865150fbc634897dd3deb 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 -r ba95cec18fe9 -r 35f2f54b557c hgext/evolve.py --- a/hgext/evolve.py Fri Jun 19 10:47:02 2015 -0700 +++ b/hgext/evolve.py Fri Jun 19 11:03:51 2015 -0700 @@ -1950,6 +1950,10 @@ 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 -r ba95cec18fe9 -r 35f2f54b557c tests/test-evolve.t --- a/tests/test-evolve.t Fri Jun 19 10:47:02 2015 -0700 +++ b/tests/test-evolve.t Fri Jun 19 11:03:51 2015 -0700 @@ -1104,3 +1104,47 @@ |/ o 18:0bb66d4c1968@default(draft) a3 | + +Check that prune respects the allowunstable option + $ hg up -C . + 0 files updated, 0 files merged, 0 files removed, 0 files unresolved + $ hg evolve --rev "22::" + move:[22] add j2 + atop:[26] add j1 + move:[23] add j3 + atop:[27] add j2 + working directory is now at 920a35e8dbd0 + $ glog -r "18::" + @ 28:920a35e8dbd0@default(draft) add j3 + | + o 27:31e050d895dd@default(draft) add j2 + | + o 26:04b32348803e@default(draft) add j1 + | + | o 20:db3d894869b0@default(draft) add gh + | | + o | 19:10ffdd7e3cc9@default(draft) add gg + |/ + o 18:0bb66d4c1968@default(draft) a3 + | + $ hg up 19 + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ mkcommit c5_ + created new head + $ hg prune '26 + 27' + abort: cannot prune in the middle of a stack + [255] + $ hg prune '19::28' + abort: cannot prune in the middle of a stack + [255] + $ hg prune '26::' + 3 changesets pruned + $ glog -r "18::" + @ 29:5a6c53544778@default(draft) add c5_ + | + | o 20:db3d894869b0@default(draft) add gh + | | + o | 19:10ffdd7e3cc9@default(draft) add gg + |/ + o 18:0bb66d4c1968@default(draft) a3 + |