revset: added __nonzero__ method to lazyset
Now it doesn't have to go through all the set and can return lazily as soon as
it finds one element.
--- a/mercurial/revset.py Wed Feb 12 15:30:27 2014 -0800
+++ b/mercurial/revset.py Thu Feb 20 10:15:38 2014 -0800
@@ -2155,6 +2155,11 @@
l = baseset([r for r in self])
return l + baseset(x)
+ def __nonzero__(self):
+ for r in self:
+ return True
+ return False
+
def __len__(self):
# Basic implementation to be changed in future patches.
l = baseset([r for r in self])