# HG changeset patch # User Lucas Moscovicz # Date 2014-02-19 17:28:17 # Node ID 6b731b29e154ba42d0f7de6eb5eee4f5fe2bdf78 # Parent 8c89433ccdcf288f7f44b8fbca7579773df80195 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. diff --git a/mercurial/revset.py b/mercurial/revset.py --- a/mercurial/revset.py +++ b/mercurial/revset.py @@ -2190,6 +2190,12 @@ class baseset(list): 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 @@ class lazyset(object): 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: