changeset 20612:60c308b932eb

revset: added basic operators to orderedlazyset Now __and__ and __sub__ return orderedlazyset.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Thu, 06 Feb 2014 17:42:08 -0800
parents 6490f8385391
children 10433163bf57 2ae1b42d0559
files mercurial/revset.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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.