Patchwork D7243: repoview: move changelog.rev() override to filteredchangelog

login
register
mail settings
Submitter phabricator
Date Nov. 6, 2019, 12:59 a.m.
Message ID <differential-rev-PHID-DREV-esmcnd3t3kpdzqu5cewd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/42769/
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/D7243

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
@@ -11,7 +11,11 @@ 
 import copy
 import weakref
 
-from .node import nullrev
+from .i18n import _
+from .node import (
+    hex,
+    nullrev,
+)
 from .pycompat import (
     delattr,
     getattr,
@@ -293,6 +297,15 @@ 
             assert not self.filteredrevs
             super(filteredchangelog, self).strip(*args, **kwargs)
 
+        def rev(self, node):
+            """filtered version of revlog.rev"""
+            r = super(filteredchangelog, self).rev(node)
+            if r in self.filteredrevs:
+                raise error.FilteredLookupError(
+                    hex(node), self.indexfile, _(b'filtered node')
+                )
+            return r
+
     cl.__class__ = filteredchangelog
 
     return cl
diff --git a/mercurial/changelog.py b/mercurial/changelog.py
--- a/mercurial/changelog.py
+++ b/mercurial/changelog.py
@@ -404,15 +404,6 @@ 
         self.filteredrevs = frozenset()
         self._copiesstorage = opener.options.get(b'copies-storage')
 
-    def rev(self, node):
-        """filtered version of revlog.rev"""
-        r = super(changelog, self).rev(node)
-        if r in self.filteredrevs:
-            raise error.FilteredLookupError(
-                hex(node), self.indexfile, _(b'filtered node')
-            )
-        return r
-
     def node(self, rev):
         """filtered version of revlog.node"""
         if rev in self.filteredrevs: