[PATCH 4 of 4 evolve-ext] evolve: make fold aware of allowunstable

Laurent Charignon lcharignon at fb.com
Thu Jun 4 13:52:17 CDT 2015


# HG changeset patch
# User Laurent Charignon <lcharignon at fb.com>
# Date 1432072589 25200
#      Tue May 19 14:56:29 2015 -0700
# Node ID da540b5fc4afd9fc7d02957f30a72321fbf3ecb4
# Parent  1c2467a8f3a936b7e1d9c02a5a750ef0de140187
evolve: make fold aware of allowunstable

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

diff --git a/hgext/evolve.py b/hgext/evolve.py
--- a/hgext/evolve.py
+++ b/hgext/evolve.py
@@ -2356,6 +2356,10 @@
         raise util.Abort(_("cannot fold non-linear revisions "
                            "(multiple heads given)"))
     head = repo[heads.first()]
+    disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt)
+    notarepohead = not head.rev() in repo.changelog.headrevs()
+    if disallowunstable and notarepohead:
+        raise util.Abort(_("cannot fold chain not ending with a head"))
     wlock = lock = None
     try:
         wlock = repo.wlock()
diff --git a/tests/test-evolve.t b/tests/test-evolve.t
--- a/tests/test-evolve.t
+++ b/tests/test-evolve.t
@@ -1179,3 +1179,29 @@
   $ hg prune bb4ea90d7601
   1 changesets pruned
 
+Check that fold respects the allowunstable option
+  $ cat >> $HGRCPATH <<EOF
+  > [experimental]
+  > evolution=createmarkers
+  > evolutioncommands=fold
+  > EOF
+  $ glog
+  @  19:10ffdd7e3cc9 at default(draft) add gg
+  |
+  o  18:0bb66d4c1968 at default(draft) a3
+  |
+  o  13:d66b1e328488 at default(draft) bumped update to f37ed7a60f43:
+  |
+  o  11:f37ed7a60f43 at mybranch(public) a2
+  |
+  o  10:9f8b83c2e7f3 at default(public) a1__
+  |
+  o  0:07c1c36d9ef0 at default(public) a0
+  
+  $ hg fold --exact "13+18" 
+  abort: cannot fold chain not ending with a head
+  [255]
+  $ hg fold --exact "13+18+19"
+  3 changesets folded
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+


More information about the Mercurial-devel mailing list