Patchwork D10572: manifest: drop the `indexfile` from `manifestrevlog`

login
register
mail settings
Submitter phabricator
Date May 3, 2021, 11:57 a.m.
Message ID <differential-rev-PHID-DREV-6lslu3olyp7lalerqkx2-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/48891/
State Superseded
Headers show

Comments

phabricator - May 3, 2021, 11:57 a.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10572

AFFECTED FILES
  mercurial/bundlerepo.py
  mercurial/changegroup.py
  mercurial/interfaces/repository.py
  mercurial/manifest.py
  mercurial/unionrepo.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -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
         )
 
 
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1902,14 +1902,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
 
diff --git a/mercurial/interfaces/repository.py b/mercurial/interfaces/repository.py
--- a/mercurial/interfaces/repository.py
+++ b/mercurial/interfaces/repository.py
@@ -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.
 
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -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
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -201,7 +201,7 @@ 
             self,
             opener,
             (revlog_constants.KIND_MANIFESTLOG, dir),
-            self.indexfile,
+            self._revlog.indexfile,
             cgunpacker,
             linkmapper,
         )