rust-index: use the new method in shortesthexnodeidprefix
authorGeorges Racinet <georges.racinet@octobus.net>
Wed, 11 Dec 2019 18:10:20 +0100
changeset 44016 992f0d6e7f33
parent 44015 443dc1655923
child 44017 8042856c90b6
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
mercurial/scmutil.py
--- 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: