revset-only: use __nonzero__ to check if a revset is empty
authorPierre-Yves David <pierre-yves.david@fb.com>
Wed, 08 Oct 2014 02:45:21 -0700
changeset 22999 88ac1be3f767
parent 22998 93e5d24692cc
child 23000 90c425f80316
revset-only: use __nonzero__ to check if a revset is empty For some smartsets, computing length is more expensive than checking if the set is empty.
mercurial/revset.py
--- a/mercurial/revset.py	Wed Oct 15 12:38:47 2014 -0700
+++ b/mercurial/revset.py	Wed Oct 08 02:45:21 2014 -0700
@@ -398,7 +398,7 @@
     args = getargs(x, 1, 2, _('only takes one or two arguments'))
     include = getset(repo, spanset(repo), args[0])
     if len(args) == 1:
-        if len(include) == 0:
+        if not include:
             return baseset()
 
         descendants = set(_revdescendants(repo, include, False))