Mercurial > hg-stable
changeset 20732:728438da3090
revset: added __add__ 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:23:54 -0700 |
parents | 88aae5382519 |
children | adf4ec7e6f60 |
files | mercurial/revset.py |
diffstat | 1 files changed, 11 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Fri Mar 14 10:22:51 2014 -0700 +++ b/mercurial/revset.py Fri Mar 14 10:23:54 2014 -0700 @@ -2425,6 +2425,17 @@ return orderedlazyset(self, filterfunc, ascending=self._ascending) return lazyset(self, filterfunc) + def __add__(self, other): + """When both collections are ascending or descending, preserve the order + """ + kwargs = {} + if self._ascending is not None: + if self.isascending() and other.isascending(): + kwargs['ascending'] = True + if self.isdescending() and other.isdescending(): + kwargs['ascending'] = False + return _addset(self, other, **kwargs) + def _iterator(self): """Iterate over both collections without repeating elements