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

Lucas Moscovicz lmoscovicz at fb.com
Thu Feb 27 16:12:51 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 079abbd960c16d19c29da248662ad7421bc75518
# Parent  f1f7558f3c3d6e4dc3b9342d86d98e4223f6c120
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,12 @@
     def filter(self, l):
         return orderedlazyset(self, l, self._order)
 
+    def __and__(self, x):
+        return orderedlazyset(self, lambda r: r in x, self._order)
+
+    def __sub__(self, x):
+        return orderedlazyset(self, lambda r: r not in x, self._order)
+
 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