# HG changeset patch # User Lucas Moscovicz # Date 2014-03-14 17:21:56 # Node ID caa69cb223b09960a777490fd7f1e2d296375a17 # Parent 1c8b62c0a47e72748e98b7a70587e9c00ae6051d revset: added ascending and descending methods to _addset This methods are intended to duck-type baseset, so we will still have _addset as a private class but will be able 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 @@ -2397,6 +2397,22 @@ class _addset(object): return orderedlazyset(self, condition, ascending=self._ascending) return lazyset(self, condition) + def ascending(self): + if self._ascending is None: + self.sort() + self._ascending = True + else: + if not self._ascending: + self.reverse() + + def descending(self): + if self._ascending is None: + self.sort(reverse=True) + self._ascending = False + else: + if self._ascending: + self.reverse() + def _iterator(self): """Iterate over both collections without repeating elements