Patchwork D7239: repoview: move changelog.__iter__() override to filteredchangelog

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 3:38 a.m.
Message ID <14655ac786bf2d29d68dee0a690318d5@localhost.localdomain>
Download mbox | patch
Permalink /patch/42784/
State Not Applicable
Headers show

Comments

phabricator - Nov. 6, 2019, 3:38 a.m.
Closed by commit rHG1a76cf41880d: repoview: move changelog.__iter__() override to filteredchangelog (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7239?vs=17569&id=17589

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7239/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7239

AFFECTED FILES
  mercurial/changelog.py
  mercurial/repoview.py

CHANGE DETAILS




To: martinvonz, #hg-reviewers, indygreg
Cc: mercurial-devel

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -21,6 +21,7 @@ 
     obsolete,
     phases,
     pycompat,
+    revlog,
     tags as tagsmod,
     util,
 )
@@ -233,6 +234,18 @@ 
             """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
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -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):