revset: added basic operators to orderedlazyset
authorLucas Moscovicz <lmoscovicz@fb.com>
Thu, 06 Feb 2014 17:42:08 -0800
changeset 20612 60c308b932eb
parent 20611 6490f8385391
child 20613 10433163bf57
child 20619 2ae1b42d0559
revset: added basic operators to orderedlazyset Now __and__ and __sub__ return orderedlazyset.
mercurial/revset.py
--- a/mercurial/revset.py	Thu Feb 06 09:28:41 2014 -0800
+++ b/mercurial/revset.py	Thu Feb 06 17:42:08 2014 -0800
@@ -2227,6 +2227,14 @@
     def filter(self, l):
         return orderedlazyset(self, l, ascending=self._ascending)
 
+    def __and__(self, x):
+        return orderedlazyset(self, lambda r: r in x,
+                ascending=self._ascending)
+
+    def __sub__(self, x):
+        return orderedlazyset(self, lambda r: r not in x,
+                ascending=self._ascending)
+
 class generatorset(object):
     """Wrapper structure for generators that provides lazy membership and can
     be iterated more than once.