Mercurial > public > mercurial-scm > hg
comparison mercurial/revlog.py @ 44014:8042856c90b6
rust-index: add a `experimental.rust.index` option to use the wrapper
Now we can start putting this wrapper on the test and benchmark grill.
Differential Revision: https://phab.mercurial-scm.org/D7660
author | Georges Racinet <georges.racinet@octobus.net> |
---|---|
date | Thu, 12 Dec 2019 18:31:17 +0100 |
parents | bdb357161d7a |
children | ab595920de0e |
comparison
equal
deleted
inserted
replaced
44013:992f0d6e7f33 | 44014:8042856c90b6 |
---|---|
104 REVIDX_RAWTEXT_CHANGING_FLAGS | 104 REVIDX_RAWTEXT_CHANGING_FLAGS |
105 | 105 |
106 parsers = policy.importmod('parsers') | 106 parsers = policy.importmod('parsers') |
107 rustancestor = policy.importrust('ancestor') | 107 rustancestor = policy.importrust('ancestor') |
108 rustdagop = policy.importrust('dagop') | 108 rustdagop = policy.importrust('dagop') |
109 rustrevlog = policy.importrust('revlog') | |
109 | 110 |
110 # Aliased for performance. | 111 # Aliased for performance. |
111 _zlibdecompress = zlib.decompress | 112 _zlibdecompress = zlib.decompress |
112 | 113 |
113 # max size of revlog with inline data | 114 # max size of revlog with inline data |
347 def packentry(self, entry, node, version, rev): | 348 def packentry(self, entry, node, version, rev): |
348 p = indexformatng_pack(*entry) | 349 p = indexformatng_pack(*entry) |
349 if rev == 0: | 350 if rev == 0: |
350 p = versionformat_pack(version) + p[4:] | 351 p = versionformat_pack(version) + p[4:] |
351 return p | 352 return p |
353 | |
354 | |
355 class rustrevlogio(revlogio): | |
356 def parseindex(self, data, inline): | |
357 index, cache = super(rustrevlogio, self).parseindex(data, inline) | |
358 return rustrevlog.MixedIndex(index), cache | |
352 | 359 |
353 | 360 |
354 class revlog(object): | 361 class revlog(object): |
355 """ | 362 """ |
356 the underlying revision storage object | 363 the underlying revision storage object |
583 self._sparserevlog = False | 590 self._sparserevlog = False |
584 | 591 |
585 self._storedeltachains = True | 592 self._storedeltachains = True |
586 | 593 |
587 self._io = revlogio() | 594 self._io = revlogio() |
595 if rustrevlog is not None and self.opener.options.get('rust.index'): | |
596 self._io = rustrevlogio() | |
588 if self.version == REVLOGV0: | 597 if self.version == REVLOGV0: |
589 self._io = revlogoldio() | 598 self._io = revlogoldio() |
590 try: | 599 try: |
591 d = self._io.parseindex(indexdata, self._inline) | 600 d = self._io.parseindex(indexdata, self._inline) |
592 except (ValueError, IndexError): | 601 except (ValueError, IndexError): |