# HG changeset patch # User Pierre-Yves David # Date 1440723453 25200 # Node ID ab66c1dee405aca0c51b8f76eab255d805c194d7 # Parent ce26928cbe411582fd9e8135b403c4b184b4de60 revset: cache smartset's min/max As the content of a smartset never changes, min and max will never change either. This will save us time when this function is called multiple times. This is relevant for issue4782 but does not fix it. diff -r ce26928cbe41 -r ab66c1dee405 mercurial/revset.py --- a/mercurial/revset.py Fri Aug 28 10:53:55 2015 -0400 +++ b/mercurial/revset.py Thu Aug 27 17:57:33 2015 -0700 @@ -2885,6 +2885,7 @@ """True if the set will iterate in descending order""" raise NotImplementedError() + @util.cachefunc def min(self): """return the minimum element in the set""" if self.fastasc is not None: @@ -2893,6 +2894,7 @@ raise ValueError('arg is an empty sequence') return min(self) + @util.cachefunc def max(self): """return the maximum element in the set""" if self.fastdesc is not None: