changeset 1415:aaccca501ae0

evolve: drop len comparison in prune and fold Computing the length of a smartest may be significantly more expensive than computing it length.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Mon, 22 Jun 2015 15:04:54 -0700
parents 4198e2fad6ba
children b8a9d2e8c772
files hgext/evolve.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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