D4641: localrepo: pass root manifest into manifestlog.__init__

indygreg (Gregory Szorc) phabricator at mercurial-scm.org
Sun Sep 23 05:39:30 EDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG5ccd791344f3: localrepo: pass root manifest into manifestlog.__init__ (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D4641?vs=11175&id=11267

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

AFFECTED FILES
  contrib/perf.py
  mercurial/bundlerepo.py
  mercurial/localrepo.py
  mercurial/manifest.py
  mercurial/statichttprepo.py
  mercurial/unionrepo.py
  tests/test-check-interfaces.py

CHANGE DETAILS

diff --git a/tests/test-check-interfaces.py b/tests/test-check-interfaces.py
--- a/tests/test-check-interfaces.py
+++ b/tests/test-check-interfaces.py
@@ -184,7 +184,7 @@
     checkzobject(fl, allowextra=True)
 
     # Conforms to imanifestlog.
-    ml = manifest.manifestlog(vfs, repo)
+    ml = manifest.manifestlog(vfs, repo, manifest.manifestrevlog(repo.svfs))
     checkzobject(ml)
     checkzobject(repo.manifestlog)
 
diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -208,6 +208,12 @@
     def changelog(self):
         return unionchangelog(self.svfs, self.repo2.svfs)
 
+    @localrepo.unfilteredpropertycache
+    def manifestlog(self):
+        rootstore = unionmanifest(self.svfs, self.repo2.svfs,
+                                  self.unfiltered()._clrev)
+        return manifest.manifestlog(self.svfs, self, rootstore)
+
     def _clrev(self, rev2):
         """map from repo2 changelog rev to temporary rev in self.changelog"""
         node = self.repo2.changelog.node(rev2)
diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -185,7 +185,8 @@
         self._filecache = {}
         self.requirements = requirements
 
-        self.manifestlog = manifest.manifestlog(self.svfs, self)
+        rootmanifest = manifest.manifestrevlog(self.svfs)
+        self.manifestlog = manifest.manifestlog(self.svfs, self, rootmanifest)
         self.changelog = changelog.changelog(self.svfs)
         self._tags = None
         self.nodetagscache = None
diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1609,7 +1609,7 @@
     of the list of files in the given commit. Consumers of the output of this
     class do not care about the implementation details of the actual manifests
     they receive (i.e. tree or flat or lazily loaded, etc)."""
-    def __init__(self, opener, repo):
+    def __init__(self, opener, repo, rootstore):
         usetreemanifest = False
         cachesize = 4
 
@@ -1620,7 +1620,7 @@
 
         self._treemanifests = usetreemanifest
 
-        self._rootstore = repo._constructmanifest()
+        self._rootstore = rootstore
         self._rootstore._setupmanifestcachehooks(repo)
         self._narrowmatch = repo.narrowmatch()
 
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -994,15 +994,10 @@
         return changelog.changelog(self.svfs,
                                    trypending=txnutil.mayhavepending(self.root))
 
-    def _constructmanifest(self):
-        # This is a temporary function while we migrate from manifest to
-        # manifestlog. It allows bundlerepo and unionrepo to intercept the
-        # manifest creation.
-        return manifest.manifestrevlog(self.svfs)
-
     @storecache('00manifest.i')
     def manifestlog(self):
-        return manifest.manifestlog(self.svfs, self)
+        rootstore = manifest.manifestrevlog(self.svfs)
+        return manifest.manifestlog(self.svfs, self, rootstore)
 
     @repofilecache('dirstate')
     def dirstate(self):
diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -364,14 +364,16 @@
         self.manstart = self._cgunpacker.tell()
         return c
 
-    def _constructmanifest(self):
+    @localrepo.unfilteredpropertycache
+    def manifestlog(self):
         self._cgunpacker.seek(self.manstart)
         # consume the header if it exists
         self._cgunpacker.manifestheader()
         linkmapper = self.unfiltered().changelog.rev
-        m = bundlemanifest(self.svfs, self._cgunpacker, linkmapper)
+        rootstore = bundlemanifest(self.svfs, self._cgunpacker, linkmapper)
         self.filestart = self._cgunpacker.tell()
-        return m
+
+        return manifest.manifestlog(self.svfs, self, rootstore)
 
     def _consumemanifest(self):
         """Consumes the manifest portion of the bundle, setting filestart so the
diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -495,7 +495,9 @@
     repocleartagscache = repocleartagscachefunc(repo)
     def t():
         repo.changelog = mercurial.changelog.changelog(svfs)
-        repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo)
+        rootmanifest = mercurial.manifest.manifestrevlog(svfs)
+        repo.manifestlog = mercurial.manifest.manifestlog(svfs, repo,
+                                                          rootmanifest)
         repocleartagscache()
         return len(repo.tags())
     timer(t)



To: indygreg, #hg-reviewers
Cc: yuja, mercurial-devel


More information about the Mercurial-devel mailing list