Patchwork [1,of,4,STABLE] manifest: move manifest creation to a helper function

login
register
mail settings
Submitter Durham Goode
Date Oct. 19, 2016, 12:50 a.m.
Message ID <f4e70498d617737c4737.1476838214@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/17174/
State Accepted
Headers show

Comments

Durham Goode - Oct. 19, 2016, 12:50 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1476837171 25200
#      Tue Oct 18 17:32:51 2016 -0700
# Branch stable
# Node ID f4e70498d617737c47371a86c2177146c7b789fe
# Parent  e478f11e418288b8308457303d3ddf6a23f874f8
manifest: move manifest creation to a helper function

A future patch will be moving manifest creation to be inside manifestlog as part
of improving our cache guarantees. bundlerepo and unionrepo currently rely on
being able to hook into manifest creation, so let's temporarily move the actual
manifest creation to a helper function for them to intercept.

In the future manifest.manifest() will disappear entirely and this can
disappear.

Patch

diff --git a/mercurial/bundlerepo.py b/mercurial/bundlerepo.py
--- a/mercurial/bundlerepo.py
+++ b/mercurial/bundlerepo.py
@@ -343,8 +343,7 @@  class bundlerepository(localrepo.localre
         self.manstart = self.bundle.tell()
         return c
 
-    @localrepo.unfilteredpropertycache
-    def manifest(self):
+    def _constructmanifest(self):
         self.bundle.seek(self.manstart)
         # consume the header if it exists
         self.bundle.manifestheader()
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -506,6 +506,12 @@  class localrepository(object):
 
     @storecache('00manifest.i')
     def manifest(self):
+        return self._constructmanifest()
+
+    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.manifest(self.svfs)
 
     @property
diff --git a/mercurial/unionrepo.py b/mercurial/unionrepo.py
--- a/mercurial/unionrepo.py
+++ b/mercurial/unionrepo.py
@@ -208,8 +208,7 @@  class unionrepository(localrepo.localrep
         node = self.repo2.changelog.node(rev2)
         return self.changelog.rev(node)
 
-    @localrepo.unfilteredpropertycache
-    def manifest(self):
+    def _constructmanifest(self):
         return unionmanifest(self.svfs, self.repo2.svfs,
                              self.unfiltered()._clrev)