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.
--- 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