Comments
Patch
@@ -2146,6 +2146,9 @@
l = [r for r in x if r not in s]
return baseset(list(self) + l)
+ def filter(self, l):
+ return lazyset(self, l)
+
class lazyset(object):
"""Duck type for baseset class which iterates lazily over the revisions in
the subset and contains a function which tests for membership in the
@@ -2204,6 +2207,9 @@
def set(self):
return set([r for r in self])
+ def filter(self, l):
+ return lazyset(self, l)
+
class orderedlazyset(lazyset):
"""Subclass of lazyset which subset can be ordered either ascending or
descendingly
@@ -2212,6 +2218,9 @@
super(orderedlazyset, self).__init__(subset, condition)
self._order = order
+ def filter(self, l):
+ return orderedlazyset(self, l, self._order)
+
class generatorset(object):
"""Wrapper structure for generators that provides lazy membership and can
be iterated more than once.
@@ -2345,5 +2354,11 @@
def set(self):
return self
+ def filter(self, l):
+ if self._start <= self._end:
+ return orderedlazyset(self, l, 'asc')
+ else:
+ return orderedlazyset(self, l, 'desc')
+
# tell hggettext to extract docstrings from these functions:
i18nfunctions = symbols.values()