##// END OF EJS Templates
revset: changed lazyset __add__ implementation to work lazily...
Lucas Moscovicz -
r20586:2d52f379 default
parent child Browse files
Show More
@@ -2151,7 +2151,7 b' class lazyset(object):'
2151 the subset and contains a function which tests for membership in the
2151 the subset and contains a function which tests for membership in the
2152 revset
2152 revset
2153 """
2153 """
2154 def __init__(self, subset, condition):
2154 def __init__(self, subset, condition=lambda x: True):
2155 self._subset = subset
2155 self._subset = subset
2156 self._condition = condition
2156 self._condition = condition
2157 self._cache = {}
2157 self._cache = {}
@@ -2175,8 +2175,14 b' class lazyset(object):'
2175 return lazyset(self, lambda r: r not in x)
2175 return lazyset(self, lambda r: r not in x)
2176
2176
2177 def __add__(self, x):
2177 def __add__(self, x):
2178 l = baseset([r for r in self])
2178 def iterates():
2179 return l + baseset(x)
2179 for r in self:
2180 yield r
2181 for r in x:
2182 if r not in self:
2183 yield r
2184
2185 return lazyset(generatorset(iterates()))
2180
2186
2181 def __nonzero__(self):
2187 def __nonzero__(self):
2182 for r in self:
2188 for r in self:
General Comments 0
You need to be logged in to leave comments. Login now