Mercurial > hg-stable
changeset 20748:6b731b29e154
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.
author | Lucas Moscovicz <lmoscovicz@fb.com> |
---|---|
date | Wed, 19 Feb 2014 09:28:17 -0800 |
parents | 8c89433ccdcf |
children | c3e49b127de0 |
files | mercurial/revset.py |
diffstat | 1 files changed, 12 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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: