##// END OF EJS Templates
revset: added lazyset class with basic operations...
Lucas Moscovicz -
r20427:4a9191ca default
parent child Browse files
Show More
@@ -2072,5 +2072,23 b' class baseset(list):'
2072 2072 l = [r for r in x if r not in s]
2073 2073 return baseset(list(self) + l)
2074 2074
2075 class lazyset(object):
2076 """Duck type for baseset class which iterates lazily over the revisions in
2077 the subset and contains a function which tests for membership in the
2078 revset
2079 """
2080 def __init__(self, subset, condition):
2081 self._subset = subset
2082 self._condition = condition
2083
2084 def __contains__(self, x):
2085 return x in self._subset and self._condition(x)
2086
2087 def __iter__(self):
2088 cond = self._condition
2089 for x in self._subset:
2090 if cond(x):
2091 yield x
2092
2075 2093 # tell hggettext to extract docstrings from these functions:
2076 2094 i18nfunctions = symbols.values()
General Comments 0
You need to be logged in to leave comments. Login now