[PATCH 4 of 4] revset: added basic operators to orderedlazyset

Lucas Moscovicz lmoscovicz at fb.com
Thu Feb 27 17:54:12 CST 2014


# HG changeset patch
# User Lucas Moscovicz <lmoscovicz at fb.com>
# Date 1391737328 28800
#      Thu Feb 06 17:42:08 2014 -0800
# Node ID d9c1f97dac5f752a9def8f03bcb6604b8ee05c39
# Parent  7a2d42d243dcc61aad03d90ee83e0878fef7cd12
revset: added basic operators to orderedlazyset

Now __add__ and __sub__ return orderedlazyset.

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2221,6 +2221,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.


More information about the Mercurial-devel mailing list