changeset 22739:4ed47a1b2d24

generatorset: implement __nonzero__ This is necessary to become a real smartset.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Fri, 03 Oct 2014 01:56:57 -0500
parents 70a0664008ea
children f40a57e8fda1
files mercurial/revset.py
diffstat 1 files changed, 5 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Oct 03 00:31:33 2014 -0500
+++ b/mercurial/revset.py	Fri Oct 03 01:56:57 2014 -0500
@@ -2741,6 +2741,11 @@
         self._genlist = baseset([])
         self._finished = False
 
+    def __nonzero__(self):
+        for r in self:
+            return True
+        return False
+
     def __contains__(self, x):
         if x in self._cache:
             return self._cache[x]