# HG changeset patch # User Lucas Moscovicz # Date 2014-03-14 17:23:54 # Node ID 728438da3090676001565a92156937cf909e00da # Parent 88aae5382519840620f5a2220589a1956b7cae65 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2425,6 +2425,17 @@ class _addset(object): 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