manifest: accept narrowmatch into constructor instead of getting from repo
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 03 Dec 2018 22:22:23 -0800
changeset 41041 3913223417ea
parent 41040 2eeef8e577ac
child 41042 54c3b4bd01f2
manifest: accept narrowmatch into constructor instead of getting from repo The manifest should ideally not know at all about the repo, so this is just a little step towards cleaning that up. Differential Revision: https://phab.mercurial-scm.org/D5469
mercurial/bundlerepo.py
mercurial/localrepo.py
mercurial/manifest.py
mercurial/statichttprepo.py
mercurial/unionrepo.py
tests/test-check-interfaces.py
--- a/mercurial/bundlerepo.py	Sat Dec 22 00:05:39 2018 -0500
+++ b/mercurial/bundlerepo.py	Mon Dec 03 22:22:23 2018 -0800
@@ -374,7 +374,8 @@
         rootstore = bundlemanifest(self.svfs, self._cgunpacker, linkmapper)
         self.filestart = self._cgunpacker.tell()
 
-        return manifest.manifestlog(self.svfs, self, rootstore)
+        return manifest.manifestlog(self.svfs, self, rootstore,
+                                    self.narrowmatch())
 
     def _consumemanifest(self):
         """Consumes the manifest portion of the bundle, setting filestart so the
--- a/mercurial/localrepo.py	Sat Dec 22 00:05:39 2018 -0500
+++ b/mercurial/localrepo.py	Mon Dec 03 22:22:23 2018 -0800
@@ -1190,7 +1190,8 @@
     @storecache('00manifest.i')
     def manifestlog(self):
         rootstore = manifest.manifestrevlog(self.svfs)
-        return manifest.manifestlog(self.svfs, self, rootstore)
+        return manifest.manifestlog(self.svfs, self, rootstore,
+                                    self.narrowmatch())
 
     @repofilecache('dirstate')
     def dirstate(self):
--- a/mercurial/manifest.py	Sat Dec 22 00:05:39 2018 -0500
+++ b/mercurial/manifest.py	Mon Dec 03 22:22:23 2018 -0800
@@ -1636,7 +1636,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, rootstore):
+    def __init__(self, opener, repo, rootstore, narrowmatch):
         usetreemanifest = False
         cachesize = 4
 
@@ -1649,7 +1649,7 @@
 
         self._rootstore = rootstore
         self._rootstore._setupmanifestcachehooks(repo)
-        self._narrowmatch = repo.narrowmatch()
+        self._narrowmatch = narrowmatch
 
         # A cache of the manifestctx or treemanifestctx for each directory
         self._dirmancache = {}
--- a/mercurial/statichttprepo.py	Sat Dec 22 00:05:39 2018 -0500
+++ b/mercurial/statichttprepo.py	Mon Dec 03 22:22:23 2018 -0800
@@ -187,7 +187,8 @@
         self.requirements = requirements
 
         rootmanifest = manifest.manifestrevlog(self.svfs)
-        self.manifestlog = manifest.manifestlog(self.svfs, self, rootmanifest)
+        self.manifestlog = manifest.manifestlog(self.svfs, self, rootmanifest,
+                                                self.narrowmatch())
         self.changelog = changelog.changelog(self.svfs)
         self._tags = None
         self.nodetagscache = None
--- a/mercurial/unionrepo.py	Sat Dec 22 00:05:39 2018 -0500
+++ b/mercurial/unionrepo.py	Mon Dec 03 22:22:23 2018 -0800
@@ -212,7 +212,8 @@
     def manifestlog(self):
         rootstore = unionmanifest(self.svfs, self.repo2.svfs,
                                   self.unfiltered()._clrev)
-        return manifest.manifestlog(self.svfs, self, rootstore)
+        return manifest.manifestlog(self.svfs, self, rootstore,
+                                    self.narrowmatch())
 
     def _clrev(self, rev2):
         """map from repo2 changelog rev to temporary rev in self.changelog"""
--- a/tests/test-check-interfaces.py	Sat Dec 22 00:05:39 2018 -0500
+++ b/tests/test-check-interfaces.py	Mon Dec 03 22:22:23 2018 -0800
@@ -182,7 +182,8 @@
     checkzobject(fl, allowextra=True)
 
     # Conforms to imanifestlog.
-    ml = manifest.manifestlog(vfs, repo, manifest.manifestrevlog(repo.svfs))
+    ml = manifest.manifestlog(vfs, repo, manifest.manifestrevlog(repo.svfs),
+                              repo.narrowmatch())
     checkzobject(ml)
     checkzobject(repo.manifestlog)