revset: added basic operations to spanset
authorLucas Moscovicz <lmoscovicz@fb.com>
Wed, 12 Feb 2014 10:22:43 -0800
changeset 20483 ed57358398af
parent 20482 a979078bd788
child 20484 0f1ef9e9e904
revset: added basic operations to spanset Added methods __add__, __sub__ and __and__ to duck type more methods in baseset
mercurial/revset.py
--- a/mercurial/revset.py	Wed Feb 12 10:16:21 2014 -0800
+++ b/mercurial/revset.py	Wed Feb 12 10:22:43 2014 -0800
@@ -2149,5 +2149,15 @@
         return (x <= self._start and x > self._end) or (x >= self._start and x<
                 self._end)
 
+    def __and__(self, x):
+        return lazyset(self, lambda r: r in x)
+
+    def __sub__(self, x):
+        return lazyset(self, lambda r: r not in x)
+
+    def __add__(self, x):
+        l = baseset(self)
+        return l + baseset(x)
+
 # tell hggettext to extract docstrings from these functions:
 i18nfunctions = symbols.values()