changeset 42824:64c3db458d08

unionrepo: use a lower level overide in unionrepo too The unionrepo class also have a strange `baserevision` hack, let's try to get ride of it too.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Fri, 30 Aug 2019 17:45:38 +0200
parents 5ba8c328a895
children 62a39c868b20
files mercurial/unionrepo.py
diffstat 1 files changed, 6 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/unionrepo.py	Fri Aug 30 18:12:16 2019 +0200
+++ b/mercurial/unionrepo.py	Fri Aug 30 17:45:38 2019 +0200
@@ -14,7 +14,6 @@
 from __future__ import absolute_import
 
 from .i18n import _
-from .node import nullid
 
 from . import (
     changelog,
@@ -94,10 +93,7 @@
 
         return mdiff.textdiff(self.revision(rev1), self.revision(rev2))
 
-    def revision(self, nodeorrev, _df=None, raw=False):
-        """return an uncompressed revision of a given node or revision
-        number.
-        """
+    def _revisiondata(self, nodeorrev, _df=None, raw=False):
         if isinstance(nodeorrev, int):
             rev = nodeorrev
             node = self.node(rev)
@@ -105,16 +101,13 @@
             node = nodeorrev
             rev = self.rev(node)
 
-        if node == nullid:
-            return ""
-
         if rev > self.repotiprev:
-            text = self.revlog2.revision(node)
-            self._revisioncache = (node, rev, text)
+            # work around manifestrevlog NOT being a revlog
+            revlog2 = getattr(self.revlog2, '_revlog', self.revlog2)
+            func = revlog2._revisiondata
         else:
-            text = self.baserevision(rev)
-            # already cached
-        return text
+            func = super(unionrevlog, self)._revisiondata
+        return func(node, _df=_df, raw=raw)
 
     def rawdata(self, nodeorrev, _df=None):
         return self.revision(nodeorrev, _df=_df, raw=True)