changeset 44016:992f0d6e7f33

rust-index: use the new method in shortesthexnodeidprefix This code can now run with both a Rust or a C index. Differential Revision: https://phab.mercurial-scm.org/D7659
author Georges Racinet <georges.racinet@octobus.net>
date Wed, 11 Dec 2019 18:10:20 +0100
parents 443dc1655923
children 8042856c90b6
files mercurial/scmutil.py
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/scmutil.py	Thu Dec 12 03:39:14 2019 +0100
+++ b/mercurial/scmutil.py	Wed Dec 11 18:10:20 2019 +0100
@@ -58,6 +58,7 @@
     from . import scmposix as scmplatform
 
 parsers = policy.importmod('parsers')
+rustrevlog = policy.importrust('revlog')
 
 termsize = scmplatform.termsize
 
@@ -548,7 +549,11 @@
                 if util.safehasattr(parsers, 'nodetree'):
                     # The CExt is the only implementation to provide a nodetree
                     # class so far.
-                    nodetree = parsers.nodetree(cl.index, len(revs))
+                    index = cl.index
+                    if util.safehasattr(index, 'get_cindex'):
+                        # the rust wrapped need to give access to its internal index
+                        index = index.get_cindex()
+                    nodetree = parsers.nodetree(index, len(revs))
                     for r in revs:
                         nodetree.insert(r)
                     if cache is not None: