revset: added min and max methods to baseset and lazyset
authorLucas Moscovicz <lmoscovicz@fb.com>
Wed, 19 Feb 2014 09:28:17 -0800
changeset 20748 6b731b29e154
parent 20747 8c89433ccdcf
child 20749 c3e49b127de0
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.
mercurial/revset.py
--- 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: