D7660: rust-index: add a `experimental.rust.index` option to use the wrapper

gracinet (Georges Racinet) phabricator at mercurial-scm.org
Wed Jan 8 13:12:07 EST 2020


Closed by commit rHG8042856c90b6: rust-index: add a `experimental.rust.index` option to use the wrapper (authored by gracinet).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D7660?vs=18943&id=19084

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7660/new/

REVISION DETAIL
  https://phab.mercurial-scm.org/D7660

AFFECTED FILES
  mercurial/configitems.py
  mercurial/localrepo.py
  mercurial/revlog.py

CHANGE DETAILS

diff --git a/mercurial/revlog.py b/mercurial/revlog.py
--- a/mercurial/revlog.py
+++ b/mercurial/revlog.py
@@ -106,6 +106,7 @@
 parsers = policy.importmod('parsers')
 rustancestor = policy.importrust('ancestor')
 rustdagop = policy.importrust('dagop')
+rustrevlog = policy.importrust('revlog')
 
 # Aliased for performance.
 _zlibdecompress = zlib.decompress
@@ -351,6 +352,12 @@
         return p
 
 
+class rustrevlogio(revlogio):
+    def parseindex(self, data, inline):
+        index, cache = super(rustrevlogio, self).parseindex(data, inline)
+        return rustrevlog.MixedIndex(index), cache
+
+
 class revlog(object):
     """
     the underlying revision storage object
@@ -585,6 +592,8 @@
         self._storedeltachains = True
 
         self._io = revlogio()
+        if rustrevlog is not None and self.opener.options.get('rust.index'):
+            self._io = rustrevlogio()
         if self.version == REVLOGV0:
             self._io = revlogoldio()
         try:
diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py
--- a/mercurial/localrepo.py
+++ b/mercurial/localrepo.py
@@ -927,6 +927,9 @@
     if repository.NARROW_REQUIREMENT in requirements:
         options[b'enableellipsis'] = True
 
+    if ui.configbool('experimental', 'rust.index'):
+        options[b'rust.index'] = True
+
     return options
 
 
diff --git a/mercurial/configitems.py b/mercurial/configitems.py
--- a/mercurial/configitems.py
+++ b/mercurial/configitems.py
@@ -657,6 +657,9 @@
     b'experimental', b'revisions.disambiguatewithin', default=None,
 )
 coreconfigitem(
+    b'experimental', b'rust.index', default=False,
+)
+coreconfigitem(
     b'experimental', b'server.filesdata.recommended-batch-size', default=50000,
 )
 coreconfigitem(



To: marmoute, indygreg, #hg-reviewers, Alphare
Cc: mercurial-devel


More information about the Mercurial-devel mailing list