equal
deleted
inserted
replaced
3075 condition: a function that decide whether a revision in the subset |
3075 condition: a function that decide whether a revision in the subset |
3076 belongs to the revset or not. |
3076 belongs to the revset or not. |
3077 """ |
3077 """ |
3078 self._subset = subset |
3078 self._subset = subset |
3079 self._condition = condition |
3079 self._condition = condition |
3080 self._cache = {} |
|
3081 |
3080 |
3082 def __contains__(self, x): |
3081 def __contains__(self, x): |
3083 c = self._cache |
3082 return x in self._subset and self._condition(x) |
3084 if x not in c: |
|
3085 v = c[x] = x in self._subset and self._condition(x) |
|
3086 return v |
|
3087 return c[x] |
|
3088 |
3083 |
3089 def __iter__(self): |
3084 def __iter__(self): |
3090 return self._iterfilter(self._subset) |
3085 return self._iterfilter(self._subset) |
3091 |
3086 |
3092 def _iterfilter(self, it): |
3087 def _iterfilter(self, it): |