manifest: drop the `indexfile` from `manifestrevlog`
authorPierre-Yves David <pierre-yves.david@octobus.net>
Mon, 03 May 2021 12:21:56 +0200
changeset 47146 bc7d465ea11e
parent 47145 c6b8d5d91e73
child 47147 8a1a51d31e85
manifest: drop the `indexfile` from `manifestrevlog` Since `manifestrevlog` object are not revlog (no really, they are not…) we drop the revlog specific attribute. We need to directly access the underlying revlog in a couple of place that already assume that we have a revlog here. This is motivated by future change to that revlog attribute. Differential Revision: https://phab.mercurial-scm.org/D10572
mercurial/bundlerepo.py
mercurial/changegroup.py
mercurial/interfaces/repository.py
mercurial/manifest.py
mercurial/unionrepo.py
--- a/mercurial/bundlerepo.py	Mon May 03 12:21:46 2021 +0200
+++ b/mercurial/bundlerepo.py	Mon May 03 12:21:56 2021 +0200
@@ -201,7 +201,7 @@
             self,
             opener,
             (revlog_constants.KIND_MANIFESTLOG, dir),
-            self.indexfile,
+            self._revlog.indexfile,
             cgunpacker,
             linkmapper,
         )
--- a/mercurial/changegroup.py	Mon May 03 12:21:46 2021 +0200
+++ b/mercurial/changegroup.py	Mon May 03 12:21:56 2021 +0200
@@ -803,9 +803,15 @@
                         return i
                 # We failed to resolve a parent for this node, so
                 # we crash the changegroup construction.
+                if util.safehasattr(store, 'target'):
+                    target = store.indexfile
+                else:
+                    # some revlog not actually a revlog
+                    target = store._revlog.indexfile
+
                 raise error.Abort(
                     b"unable to resolve parent while packing '%s' %r"
-                    b' for changeset %r' % (store.indexfile, rev, clrev)
+                    b' for changeset %r' % (target, rev, clrev)
                 )
 
         return nullrev
--- a/mercurial/interfaces/repository.py	Mon May 03 12:21:46 2021 +0200
+++ b/mercurial/interfaces/repository.py	Mon May 03 12:21:56 2021 +0200
@@ -1167,13 +1167,6 @@
         """An ``ifilerevisionssequence`` instance."""
     )
 
-    indexfile = interfaceutil.Attribute(
-        """Path of revlog index file.
-
-        TODO this is revlog specific and should not be exposed.
-        """
-    )
-
     opener = interfaceutil.Attribute(
         """VFS opener to use to access underlying files used for storage.
 
--- a/mercurial/manifest.py	Mon May 03 12:21:46 2021 +0200
+++ b/mercurial/manifest.py	Mon May 03 12:21:56 2021 +0200
@@ -1907,14 +1907,6 @@
         )
 
     @property
-    def indexfile(self):
-        return self._revlog.indexfile
-
-    @indexfile.setter
-    def indexfile(self, value):
-        self._revlog.indexfile = value
-
-    @property
     def opener(self):
         return self._revlog.opener
 
--- a/mercurial/unionrepo.py	Mon May 03 12:21:46 2021 +0200
+++ b/mercurial/unionrepo.py	Mon May 03 12:21:56 2021 +0200
@@ -174,7 +174,7 @@
         manifest.manifestrevlog.__init__(self, nodeconstants, opener)
         manifest2 = manifest.manifestrevlog(nodeconstants, opener2)
         unionrevlog.__init__(
-            self, opener, self.indexfile, manifest2, linkmapper
+            self, opener, self._revlog.indexfile, manifest2, linkmapper
         )