##// 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 b'devel', b'legacy.exchange', default=list,
406 b'devel', b'legacy.exchange', default=list,
407 )
407 )
408 coreconfigitem(
408 coreconfigitem(
409 b'devel', b'persistent-nodemap', default=False,
410 )
411 coreconfigitem(
409 b'devel', b'servercafile', default=b'',
412 b'devel', b'servercafile', default=b'',
410 )
413 )
411 coreconfigitem(
414 coreconfigitem(
@@ -934,6 +934,8 b' def resolverevlogstorevfsoptions(ui, req'
934 options[b'rust.index'] = True
934 options[b'rust.index'] = True
935 if ui.configbool(b'experimental', b'exp-persistent-nodemap'):
935 if ui.configbool(b'experimental', b'exp-persistent-nodemap'):
936 options[b'exp-persistent-nodemap'] = True
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 return options
940 return options
939
941
@@ -141,6 +141,15 b' class IndexObject(BaseIndexObject):'
141 self._extra = self._extra[: i - self._lgt]
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 class InlinedIndexObject(BaseIndexObject):
153 class InlinedIndexObject(BaseIndexObject):
145 def __init__(self, data, inline=0):
154 def __init__(self, data, inline=0):
146 self._data = data
155 self._data = data
@@ -188,6 +197,12 b' def parse_index2(data, inline):'
188 return InlinedIndexObject(data, inline), (0, data)
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 def parse_dirstate(dmap, copymap, st):
206 def parse_dirstate(dmap, copymap, st):
192 parents = [st[:20], st[20:40]]
207 parents = [st[:20], st[20:40]]
193 # dereference fields so they will be local in loop
208 # dereference fields so they will be local in loop
@@ -352,6 +352,21 b' class revlogio(object):'
352 return p
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 class rustrevlogio(revlogio):
370 class rustrevlogio(revlogio):
356 def parseindex(self, data, inline):
371 def parseindex(self, data, inline):
357 index, cache = super(rustrevlogio, self).parseindex(data, inline)
372 index, cache = super(rustrevlogio, self).parseindex(data, inline)
@@ -596,9 +611,17 b' class revlog(object):'
596
611
597 self._storedeltachains = True
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 self._io = revlogio()
620 self._io = revlogio()
600 if self.version == REVLOGV0:
621 if self.version == REVLOGV0:
601 self._io = revlogoldio()
622 self._io = revlogoldio()
623 elif devel_nodemap:
624 self._io = NodemapRevlogIO()
602 elif rustrevlog is not None and self.opener.options.get(b'rust.index'):
625 elif rustrevlog is not None and self.opener.options.get(b'rust.index'):
603 self._io = rustrevlogio()
626 self._io = rustrevlogio()
604 try:
627 try:
@@ -8,6 +8,8 b' Test the persistent on-disk nodemap'
8 $ cat << EOF >> .hg/hgrc
8 $ cat << EOF >> .hg/hgrc
9 > [experimental]
9 > [experimental]
10 > exp-persistent-nodemap=yes
10 > exp-persistent-nodemap=yes
11 > [devel]
12 > persistent-nodemap=yes
11 > EOF
13 > EOF
12 $ hg debugbuilddag .+5000
14 $ hg debugbuilddag .+5000
13 $ f --size .hg/store/00changelog.n
15 $ f --size .hg/store/00changelog.n
General Comments 0
You need to be logged in to leave comments. Login now