Mercurial > hg
changeset 43445:c093fb81404f
repoview: move changelog.__iter__() override to filteredchangelog
Differential Revision: https://phab.mercurial-scm.org/D7239
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Tue, 05 Nov 2019 14:12:10 -0800 |
parents | c470e699cd00 |
children | 5ade47284dda |
files | mercurial/changelog.py mercurial/repoview.py |
diffstat | 2 files changed, 14 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/changelog.py Tue Nov 05 14:11:30 2019 -0800 +++ b/mercurial/changelog.py Tue Nov 05 14:12:10 2019 -0800 @@ -405,18 +405,6 @@ self.filteredrevs = frozenset() self._copiesstorage = opener.options.get(b'copies-storage') - def __iter__(self): - """filtered version of revlog.__iter__""" - if len(self.filteredrevs) == 0: - return revlog.revlog.__iter__(self) - - def filterediter(): - for i in pycompat.xrange(len(self)): - if i not in self.filteredrevs: - yield i - - return filterediter() - def revs(self, start=0, stop=None): """filtered version of revlog.revs""" for i in super(changelog, self).revs(start, stop):
--- a/mercurial/repoview.py Tue Nov 05 14:11:30 2019 -0800 +++ b/mercurial/repoview.py Tue Nov 05 14:12:10 2019 -0800 @@ -21,6 +21,7 @@ obsolete, phases, pycompat, + revlog, tags as tagsmod, util, ) @@ -233,6 +234,19 @@ """filtered version of revlog.__contains__""" return 0 <= rev < len(self) and rev not in self.filteredrevs + def __iter__(self): + """filtered version of revlog.__iter__""" + if len(self.filteredrevs) == 0: + return revlog.revlog.__iter__(self) + + + def filterediter(): + for i in pycompat.xrange(len(self)): + if i not in self.filteredrevs: + yield i + + return filterediter() + cl.__class__ = filteredchangelog return cl