##// END OF EJS Templates
nodemap: add a (python) index class for persistent nodemap testing...
marmoute -
r44794:6f9e8e14 default
parent child Browse files
Show More
@@ -406,6 +406,9 b' coreconfigitem('
406 406 b'devel', b'legacy.exchange', default=list,
407 407 )
408 408 coreconfigitem(
409 b'devel', b'persistent-nodemap', default=False,
410 )
411 coreconfigitem(
409 412 b'devel', b'servercafile', default=b'',
410 413 )
411 414 coreconfigitem(
@@ -934,6 +934,8 b' def resolverevlogstorevfsoptions(ui, req'
934 934 options[b'rust.index'] = True
935 935 if ui.configbool(b'experimental', b'exp-persistent-nodemap'):
936 936 options[b'exp-persistent-nodemap'] = True
937 if ui.configbool(b'devel', b'persistent-nodemap'):
938 options[b'devel-force-nodemap'] = True
937 939
938 940 return options
939 941
@@ -141,6 +141,15 b' class IndexObject(BaseIndexObject):'
141 141 self._extra = self._extra[: i - self._lgt]
142 142
143 143
144 class PersistentNodeMapIndexObject(IndexObject):
145 """a Debug oriented class to test persistent nodemap
146
147 We need a simple python object to test API and higher level behavior. See
148 the Rust implementation for more serious usage. This should be used only
149 through the dedicated `devel.persistent-nodemap` config.
150 """
151
152
144 153 class InlinedIndexObject(BaseIndexObject):
145 154 def __init__(self, data, inline=0):
146 155 self._data = data
@@ -188,6 +197,12 b' def parse_index2(data, inline):'
188 197 return InlinedIndexObject(data, inline), (0, data)
189 198
190 199
200 def parse_index_devel_nodemap(data, inline):
201 """like parse_index2, but alway return a PersistentNodeMapIndexObject
202 """
203 return PersistentNodeMapIndexObject(data), None
204
205
191 206 def parse_dirstate(dmap, copymap, st):
192 207 parents = [st[:20], st[20:40]]
193 208 # dereference fields so they will be local in loop
@@ -352,6 +352,21 b' class revlogio(object):'
352 352 return p
353 353
354 354
355 NodemapRevlogIO = None
356
357 if util.safehasattr(parsers, 'parse_index_devel_nodemap'):
358
359 class NodemapRevlogIO(revlogio):
360 """A debug oriented IO class that return a PersistentNodeMapIndexObject
361
362 The PersistentNodeMapIndexObject object is meant to test the persistent nodemap feature.
363 """
364
365 def parseindex(self, data, inline):
366 index, cache = parsers.parse_index_devel_nodemap(data, inline)
367 return index, cache
368
369
355 370 class rustrevlogio(revlogio):
356 371 def parseindex(self, data, inline):
357 372 index, cache = super(rustrevlogio, self).parseindex(data, inline)
@@ -596,9 +611,17 b' class revlog(object):'
596 611
597 612 self._storedeltachains = True
598 613
614 devel_nodemap = (
615 self.nodemap_file
616 and opts.get(b'devel-force-nodemap', False)
617 and NodemapRevlogIO is not None
618 )
619
599 620 self._io = revlogio()
600 621 if self.version == REVLOGV0:
601 622 self._io = revlogoldio()
623 elif devel_nodemap:
624 self._io = NodemapRevlogIO()
602 625 elif rustrevlog is not None and self.opener.options.get(b'rust.index'):
603 626 self._io = rustrevlogio()
604 627 try:
@@ -8,6 +8,8 b' Test the persistent on-disk nodemap'
8 8 $ cat << EOF >> .hg/hgrc
9 9 > [experimental]
10 10 > exp-persistent-nodemap=yes
11 > [devel]
12 > persistent-nodemap=yes
11 13 > EOF
12 14 $ hg debugbuilddag .+5000
13 15 $ f --size .hg/store/00changelog.n
General Comments 0
You need to be logged in to leave comments. Login now