##// END OF EJS Templates
repoview: move changelog.__iter__() override to filteredchangelog...
Martin von Zweigbergk -
r43750:c093fb81 default
parent child Browse files
Show More
@@ -405,18 +405,6 b' class changelog(revlog.revlog):'
405 405 self.filteredrevs = frozenset()
406 406 self._copiesstorage = opener.options.get(b'copies-storage')
407 407
408 def __iter__(self):
409 """filtered version of revlog.__iter__"""
410 if len(self.filteredrevs) == 0:
411 return revlog.revlog.__iter__(self)
412
413 def filterediter():
414 for i in pycompat.xrange(len(self)):
415 if i not in self.filteredrevs:
416 yield i
417
418 return filterediter()
419
420 408 def revs(self, start=0, stop=None):
421 409 """filtered version of revlog.revs"""
422 410 for i in super(changelog, self).revs(start, stop):
@@ -21,6 +21,7 b' from . import ('
21 21 obsolete,
22 22 phases,
23 23 pycompat,
24 revlog,
24 25 tags as tagsmod,
25 26 util,
26 27 )
@@ -233,6 +234,19 b' def wrapchangelog(unfichangelog, filtere'
233 234 """filtered version of revlog.__contains__"""
234 235 return 0 <= rev < len(self) and rev not in self.filteredrevs
235 236
237 def __iter__(self):
238 """filtered version of revlog.__iter__"""
239 if len(self.filteredrevs) == 0:
240 return revlog.revlog.__iter__(self)
241
242
243 def filterediter():
244 for i in pycompat.xrange(len(self)):
245 if i not in self.filteredrevs:
246 yield i
247
248 return filterediter()
249
236 250 cl.__class__ = filteredchangelog
237 251
238 252 return cl
General Comments 0
You need to be logged in to leave comments. Login now