comparison mercurial/revset.py @ 20731:88aae5382519

revset: added __sub__ mehtod to _addset This method is intended to duck-type baseset, so we will still have _addset as a private class but now 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:51 -0700
parents 180d47e1fb68
children 728438da3090
comparison
equal deleted inserted replaced
20730:180d47e1fb68 20731:88aae5382519
2417 filterfunc = other.__contains__ 2417 filterfunc = other.__contains__
2418 if self._ascending is not None: 2418 if self._ascending is not None:
2419 return orderedlazyset(self, filterfunc, ascending=self._ascending) 2419 return orderedlazyset(self, filterfunc, ascending=self._ascending)
2420 return lazyset(self, filterfunc) 2420 return lazyset(self, filterfunc)
2421 2421
2422 def __sub__(self, other):
2423 filterfunc = lambda r: r not in other
2424 if self._ascending is not None:
2425 return orderedlazyset(self, filterfunc, ascending=self._ascending)
2426 return lazyset(self, filterfunc)
2427
2422 def _iterator(self): 2428 def _iterator(self):
2423 """Iterate over both collections without repeating elements 2429 """Iterate over both collections without repeating elements
2424 2430
2425 If the ascending attribute is not set, iterate over the first one and 2431 If the ascending attribute is not set, iterate over the first one and
2426 then over the second one checking for membership on the first one so we 2432 then over the second one checking for membership on the first one so we