mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 07:17:55 +03:00
manifestv2: set requires at repo creation time
While it should be safe to switch to the new manifest format on an existing repo, let's keep it simple for now and make the configuration have any effect only at repo creation time. If the configuration is enabled then (at repo creation), we add an entry to requires and read that instead of the configuration from then on.
This commit is contained in:
parent
e12d2d5528
commit
e931247479
@ -174,10 +174,10 @@ class locallegacypeer(localpeer):
|
||||
|
||||
class localrepository(object):
|
||||
|
||||
supportedformats = set(('revlogv1', 'generaldelta'))
|
||||
supportedformats = set(('revlogv1', 'generaldelta', 'manifestv2'))
|
||||
_basesupported = supportedformats | set(('store', 'fncache', 'shared',
|
||||
'dotencode'))
|
||||
openerreqs = set(('revlogv1', 'generaldelta'))
|
||||
openerreqs = set(('revlogv1', 'generaldelta', 'manifestv2'))
|
||||
requirements = ['revlogv1']
|
||||
filtername = None
|
||||
|
||||
@ -241,6 +241,8 @@ class localrepository(object):
|
||||
)
|
||||
if self.ui.configbool('format', 'generaldelta', False):
|
||||
requirements.append("generaldelta")
|
||||
if self.ui.configbool('experimental', 'manifestv2', False):
|
||||
requirements.append("manifestv2")
|
||||
requirements = set(requirements)
|
||||
else:
|
||||
raise error.RepoError(_("repository %s not found") % path)
|
||||
@ -334,9 +336,6 @@ class localrepository(object):
|
||||
usetreemanifest = self.ui.configbool('experimental', 'treemanifest')
|
||||
if usetreemanifest is not None:
|
||||
self.svfs.options['usetreemanifest'] = usetreemanifest
|
||||
usemanifestv2 = self.ui.configbool('experimental', 'manifestv2')
|
||||
if usemanifestv2 is not None:
|
||||
self.svfs.options['usemanifestv2'] = usemanifestv2
|
||||
|
||||
def _writerequirements(self):
|
||||
reqfile = self.vfs("requires", "w")
|
||||
|
@ -605,7 +605,7 @@ class manifest(revlog.revlog):
|
||||
if opts is not None:
|
||||
cachesize = opts.get('manifestcachesize', cachesize)
|
||||
usetreemanifest = opts.get('usetreemanifest', usetreemanifest)
|
||||
usemanifestv2 = opts.get('usemanifestv2', usemanifestv2)
|
||||
usemanifestv2 = opts.get('manifestv2', usemanifestv2)
|
||||
self._mancache = util.lrucachedict(cachesize)
|
||||
revlog.revlog.__init__(self, opener, "00manifest.i")
|
||||
self._usetreemanifest = usetreemanifest
|
||||
|
31
tests/test-manifestv2.t
Normal file
31
tests/test-manifestv2.t
Normal file
@ -0,0 +1,31 @@
|
||||
Check that entry is added to .hg/requires
|
||||
|
||||
$ hg --config experimental.manifestv2=True init repo
|
||||
$ cd repo
|
||||
$ grep manifestv2 .hg/requires
|
||||
manifestv2
|
||||
|
||||
Set up simple repo
|
||||
|
||||
$ echo a > file1
|
||||
$ echo b > file2
|
||||
$ echo c > file3
|
||||
$ hg ci -Aqm 'initial'
|
||||
$ echo d > file2
|
||||
$ hg ci -m 'modify file2'
|
||||
|
||||
Check that 'hg verify', which uses manifest.readdelta(), works
|
||||
|
||||
$ hg verify
|
||||
checking changesets
|
||||
checking manifests
|
||||
crosschecking files in changesets and manifests
|
||||
checking files
|
||||
3 files, 2 changesets, 4 total revisions
|
||||
|
||||
TODO: Check that manifest revlog is smaller than for v1
|
||||
|
||||
$ hg debugindex -m
|
||||
rev offset length base linkrev nodeid p1 p2
|
||||
0 0 106 0 0 f6279f9f8b31 000000000000 000000000000
|
||||
1 106 59 0 1 cd20459b75e6 f6279f9f8b31 000000000000
|
Loading…
Reference in New Issue
Block a user