revset: added min and max methods to baseset and lazyset
This classes have no particular order so they rely on python min() and max()
implementation. This methods will be implemented in every smartset class in
future patches. For other classes there are lazy implementations that can be
made for this methods.
--- a/mercurial/revset.py Fri Mar 14 15:47:29 2014 -0700
+++ b/mercurial/revset.py Wed Feb 19 09:28:17 2014 -0800
@@ -2190,6 +2190,12 @@
This is part of the mandatory API for smartset."""
self.sort(reverse=True)
+ def min(self):
+ return min(self)
+
+ def max(self):
+ return max(self)
+
def set(self):
"""Returns a set or a smartset containing all the elements.
@@ -2268,6 +2274,12 @@
def descending(self):
self._subset.sort(reverse=True)
+ def min(self):
+ return min(self)
+
+ def max(self):
+ return max(self)
+
def __contains__(self, x):
c = self._cache
if x not in c: