changeset 43449:c45195f9af0a

repoview: move changelog.rev() override to filteredchangelog Differential Revision: https://phab.mercurial-scm.org/D7243
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 05 Nov 2019 14:21:47 -0800
parents c31fa28d1843
children 6f3222bbfce0
files mercurial/changelog.py mercurial/repoview.py
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- 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