comparison mercurial/revlog.py @ 44313:6f9e8e142cea

nodemap: add a (python) index class for persistent nodemap testing Using the persistent nodemap require a compeling performance boost and an existing implementation. The benefit of the persistent nodemap for pure python code is unclear and we don't have a C implementation for it. Yet we would like to actually start testing it in more details and define an API for using that persistent nodemap. We introduce a new `devel` config option to use an index class dedicated to Nodemap Testing. This feature is "pure" only because having using a pure-python index with the `cext` policy proved more difficult than I would like. There is nothing going on in that class for now, but the coming changeset will change that. Differential Revision: https://phab.mercurial-scm.org/D7840
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Wed, 15 Jan 2020 15:48:09 +0100
parents daad3aace942
children 671f9479af0e
comparison
equal deleted inserted replaced
44312:563dfdfd01a4 44313:6f9e8e142cea
350 if rev == 0: 350 if rev == 0:
351 p = versionformat_pack(version) + p[4:] 351 p = versionformat_pack(version) + p[4:]
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)
358 return rustrevlog.MixedIndex(index), cache 373 return rustrevlog.MixedIndex(index), cache
359 374
594 if not self._generaldelta: 609 if not self._generaldelta:
595 self._sparserevlog = False 610 self._sparserevlog = False
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:
605 d = self._io.parseindex(indexdata, self._inline) 628 d = self._io.parseindex(indexdata, self._inline)
606 except (ValueError, IndexError): 629 except (ValueError, IndexError):