Mercurial > public > mercurial-scm > hg
comparison mercurial/revset.py @ 20730:180d47e1fb68
revset: added __and__ method to _addset
This method is intended to duck-type baseset, so we will still have _addset as a
private class but we 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:29 -0700 |
parents | caa69cb223b0 |
children | 88aae5382519 |
comparison
equal
deleted
inserted
replaced
20729:caa69cb223b0 | 20730:180d47e1fb68 |
---|---|
2411 self._ascending = False | 2411 self._ascending = False |
2412 else: | 2412 else: |
2413 if self._ascending: | 2413 if self._ascending: |
2414 self.reverse() | 2414 self.reverse() |
2415 | 2415 |
2416 def __and__(self, other): | |
2417 filterfunc = other.__contains__ | |
2418 if self._ascending is not None: | |
2419 return orderedlazyset(self, filterfunc, ascending=self._ascending) | |
2420 return lazyset(self, filterfunc) | |
2421 | |
2416 def _iterator(self): | 2422 def _iterator(self): |
2417 """Iterate over both collections without repeating elements | 2423 """Iterate over both collections without repeating elements |
2418 | 2424 |
2419 If the ascending attribute is not set, iterate over the first one and | 2425 If the ascending attribute is not set, iterate over the first one and |
2420 then over the second one checking for membership on the first one so we | 2426 then over the second one checking for membership on the first one so we |