Patchwork D7238: repoview: move changelog.__contains__() override to filteredchangelog

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 12:59 a.m.
Message ID <differential-rev-PHID-DREV-olixc3v3cz4ew6blp5zd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42764/
State Superseded
Headers show

Comments

phabricator - Nov. 6, 2019, 12:59 a.m.
martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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

CHANGE DETAILS




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

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -229,6 +229,10 @@ 
                 if i not in self.filteredrevs:
                     return i
 
+        def __contains__(self, rev):
+            """filtered version of revlog.__contains__"""
+            return 0 <= rev < len(self) and rev not in self.filteredrevs
+
     cl.__class__ = filteredchangelog
 
     return cl
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -405,10 +405,6 @@ 
         self.filteredrevs = frozenset()
         self._copiesstorage = opener.options.get(b'copies-storage')
 
-    def __contains__(self, rev):
-        """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: