Patchwork [1,of,2,V3] manifest: allow specifying the revlog filename

login
register
mail settings
Submitter Durham Goode
Date March 2, 2017, 12:37 a.m.
Message ID <9c89185b63f574cad1d4.1488415054@dev111.prn1.facebook.com>
Download mbox | patch
Permalink /patch/18857/
State Accepted
Delegated to: Martin von Zweigbergk
Headers show

Comments

Durham Goode - March 2, 2017, 12:37 a.m.
# HG changeset patch
# User Durham Goode <durham@fb.com>
# Date 1488414957 28800
#      Wed Mar 01 16:35:57 2017 -0800
# Node ID 9c89185b63f574cad1d4009f6c9dd511a2cba986
# Parent  0bb3089fe73527c64f1afc40b86ecb8dfe7fd7aa
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.
via Mercurial-devel - March 3, 2017, 5:36 p.m.
On Wed, Mar 1, 2017 at 4:37 PM, Durham Goode <durham@fb.com> wrote:
> # HG changeset patch
> # User Durham Goode <durham@fb.com>
> # Date 1488414957 28800
> #      Wed Mar 01 16:35:57 2017 -0800
> # Node ID 9c89185b63f574cad1d4009f6c9dd511a2cba986
> # Parent  0bb3089fe73527c64f1afc40b86ecb8dfe7fd7aa
> manifest: allow specifying the revlog filename

Queued patch 1/2, thanks.

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -1132,7 +1132,12 @@  class manifestrevlog(revlog.revlog):
     '''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 @@  class manifestrevlog(revlog.revlog):
 
         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: