changeset 20483:ed57358398af

revset: added basic operations to spanset Added methods __add__, __sub__ and __and__ to duck type more methods in baseset
author Lucas Moscovicz <lmoscovicz@fb.com>
date Wed, 12 Feb 2014 10:22:43 -0800
parents a979078bd788
children 0f1ef9e9e904
files mercurial/revset.py
diffstat 1 files changed, 10 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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()