Mercurial > hg
comparison mercurial/revset.py @ 22747:510432d66638
addset: use base implementation for __add__
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Fri, 03 Oct 2014 01:33:32 -0500 |
parents | 11a543b5de6f |
children | 852191f71df1 |
comparison
equal
deleted
inserted
replaced
22746:11a543b5de6f | 22747:510432d66638 |
---|---|
2605 self._ascending = False | 2605 self._ascending = False |
2606 else: | 2606 else: |
2607 if self._ascending: | 2607 if self._ascending: |
2608 self.reverse() | 2608 self.reverse() |
2609 | 2609 |
2610 def __add__(self, other): | |
2611 """When both collections are ascending or descending, preserve the order | |
2612 """ | |
2613 kwargs = {} | |
2614 if self._ascending is not None: | |
2615 if self.isascending() and other.isascending(): | |
2616 kwargs['ascending'] = True | |
2617 if self.isdescending() and other.isdescending(): | |
2618 kwargs['ascending'] = False | |
2619 return _addset(self, other, **kwargs) | |
2620 | |
2621 def _iterator(self): | 2610 def _iterator(self): |
2622 """Iterate over both collections without repeating elements | 2611 """Iterate over both collections without repeating elements |
2623 | 2612 |
2624 If the ascending attribute is not set, iterate over the first one and | 2613 If the ascending attribute is not set, iterate over the first one and |
2625 then over the second one checking for membership on the first one so we | 2614 then over the second one checking for membership on the first one so we |