changeset 22999:88ac1be3f767

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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 08 Oct 2014 02:45:21 -0700
parents 93e5d24692cc
children 90c425f80316
files mercurial/revset.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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))