diff hgext/evolve.py @ 1398:7ddcbf5469bc

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.
author Laurent Charignon <lcharignon@fb.com>
date Fri, 19 Jun 2015 11:04:18 -0700
parents 35f2f54b557c
children 08ae023882f1
line wrap: on
line diff
--- a/hgext/evolve.py	Fri Jun 19 11:03:51 2015 -0700
+++ b/hgext/evolve.py	Fri Jun 19 11:04:18 2015 -0700
@@ -2445,6 +2445,11 @@
         raise util.Abort(_("cannot fold non-linear revisions "
                            "(multiple heads given)"))
     head = repo[heads.first()]
+    disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt)
+    if disallowunstable:
+        if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0:
+            raise util.Abort(_("cannot fold chain not ending with a head "\
+                               "or with branching"))
     wlock = lock = None
     try:
         wlock = repo.wlock()