changeset 31151:6d9f8bc2b5ea

manifest: allow specifying the revlog filename Previously we had hardcoded the manifest filename to be 00manifest.i. In our external treemanifest extension, we want to allow writing a treemanifest side by side with a flat manifest, so we need to be able to store the root revisions at a different location (in our extension we use 00manifesttree.i). This patches moves the revlog name to a parameter so we can adjust it.
author Durham Goode <durham@fb.com>
date Wed, 01 Mar 2017 16:35:57 -0800
parents 7c54917b31f6
children b7cef987356d
files mercurial/manifest.py
diffstat 1 files changed, 12 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/manifest.py	Fri Mar 03 15:30:48 2017 +0530
+++ b/mercurial/manifest.py	Wed Mar 01 16:35:57 2017 -0800
@@ -1132,7 +1132,12 @@
     '''A revlog that stores manifest texts. This is responsible for caching the
     full-text manifest contents.
     '''
-    def __init__(self, opener, dir='', dirlogcache=None):
+    def __init__(self, opener, dir='', dirlogcache=None, indexfile=None):
+        """Constructs a new manifest revlog
+
+        `indexfile` - used by extensions to have two manifests at once, like
+        when transitioning between flatmanifeset and treemanifests.
+        """
         # During normal operations, we expect to deal with not more than four
         # revs at a time (such as during commit --amend). When rebasing large
         # stacks of commits, the number can go up, hence the config knob below.
@@ -1150,12 +1155,16 @@
 
         self._fulltextcache = util.lrucachedict(cachesize)
 
-        indexfile = "00manifest.i"
         if dir:
             assert self._treeondisk, 'opts is %r' % opts
             if not dir.endswith('/'):
                 dir = dir + '/'
-            indexfile = "meta/" + dir + "00manifest.i"
+
+        if indexfile is None:
+            indexfile = '00manifest.i'
+            if dir:
+                indexfile = "meta/" + dir + indexfile
+
         self._dir = dir
         # The dirlogcache is kept on the root manifest log
         if dir: