evolve: drop len comparison in prune and fold
authorPierre-Yves David <pierre-yves.david@fb.com>
Mon, 22 Jun 2015 15:04:54 -0700
changeset 1415 aaccca501ae0
parent 1414 4198e2fad6ba
child 1416 b8a9d2e8c772
evolve: drop len comparison in prune and fold Computing the length of a smartest may be significantly more expensive than computing it length.
hgext/evolve.py
--- a/hgext/evolve.py	Sat Jun 20 02:04:37 2015 -0700
+++ b/hgext/evolve.py	Mon Jun 22 15:04:54 2015 -0700
@@ -2087,7 +2087,7 @@
             raise util.Abort('nothing to prune')
 
         if not obsolete.isenabled(repo, obsolete.allowunstableopt):
-            if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0:
+            if repo.revs("(%ld::) - %ld", revs, revs):
                 raise util.Abort(_("cannot prune in the middle of a stack"))
 
         # defines successors changesets
@@ -2583,7 +2583,7 @@
     head = repo[heads.first()]
     disallowunstable = not obsolete.isenabled(repo, obsolete.allowunstableopt)
     if disallowunstable:
-        if len(repo.revs("(%ld::) - %ld", revs, revs)) != 0:
+        if repo.revs("(%ld::) - %ld", revs, revs):
             raise util.Abort(_("cannot fold chain not ending with a head "\
                                "or with branching"))
     wlock = lock = None