Mercurial > hg
changeset 22720:4388f99c5512
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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 30 Sep 2014 23:36:57 -0500 |
parents | 21fda9dcd4e8 |
children | adc43967d401 |
files | mercurial/revset.py |
diffstat | 1 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- 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__)