# HG changeset patch # User Lucas Moscovicz # Date 1394817716 25200 # 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 -r 1c8b62c0a47e -r caa69cb223b0 mercurial/revset.py --- a/mercurial/revset.py Thu Mar 13 19:12:36 2014 -0700 +++ b/mercurial/revset.py Fri Mar 14 10:21:56 2014 -0700 @@ -2397,6 +2397,22 @@ 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