repoview: move changelog.rev() override to filteredchangelog
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 05 Nov 2019 14:21:47 -0800
changeset 43449 c45195f9af0a
parent 43448 c31fa28d1843
child 43450 6f3222bbfce0
repoview: move changelog.rev() override to filteredchangelog Differential Revision: https://phab.mercurial-scm.org/D7243
mercurial/changelog.py
mercurial/repoview.py
--- a/mercurial/changelog.py	Tue Nov 05 14:17:58 2019 -0800
+++ b/mercurial/changelog.py	Tue Nov 05 14:21:47 2019 -0800
@@ -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:
--- a/mercurial/repoview.py	Tue Nov 05 14:17:58 2019 -0800
+++ b/mercurial/repoview.py	Tue Nov 05 14:21:47 2019 -0800
@@ -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,
@@ -294,6 +298,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