# HG changeset patch # User Pierre-Yves David # Date 1412138217 18000 # Node ID 4388f99c551249c1799ba570227e86ba8447eaa9 # Parent 21fda9dcd4e86111044a0a3172184b6721c70999 lazyset: inherit the fastasc and fastdesc method from subset When the filtered subset has such methods, we can use them. It is implemented as properties to be able to quickly return None if no corresponding fastasc exists on the subset. diff -r 21fda9dcd4e8 -r 4388f99c5512 mercurial/revset.py --- a/mercurial/revset.py Thu Oct 02 18:25:37 2014 -0500 +++ b/mercurial/revset.py Tue Sep 30 23:36:57 2014 -0500 @@ -2444,6 +2444,20 @@ if cond(x): yield x + @property + def fastasc(self): + it = self._subset.fastasc + if it is None: + return None + return lambda: self._iterfilter(it()) + + @property + def fastdesc(self): + it = self._subset.fastdesc + if it is None: + return None + return lambda: self._iterfilter(it()) + def __and__(self, x): return lazyset(self, x.__contains__)