changeset 20731:88aae5382519

revset: added __sub__ mehtod to _addset This method is intended to duck-type baseset, so we will still have _addset as a private class but now will be able to return it without wrapping it into an orderedlazyset or a lazyset.
author Lucas Moscovicz <lmoscovicz@fb.com>
date Fri, 14 Mar 2014 10:22:51 -0700
parents 180d47e1fb68
children 728438da3090
files mercurial/revset.py
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/revset.py	Fri Mar 14 10:22:29 2014 -0700
+++ b/mercurial/revset.py	Fri Mar 14 10:22:51 2014 -0700
@@ -2419,6 +2419,12 @@
             return orderedlazyset(self, filterfunc, ascending=self._ascending)
         return lazyset(self, filterfunc)
 
+    def __sub__(self, other):
+        filterfunc = lambda r: r not in other
+        if self._ascending is not None:
+            return orderedlazyset(self, filterfunc, ascending=self._ascending)
+        return lazyset(self, filterfunc)
+
     def _iterator(self):
         """Iterate over both collections without repeating elements