D7659: rust-index: use the new method in shortesthexnodeidprefix

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Dec 13 20:13:16 UTC 2019


marmoute created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This code can now run with both a Rust or a C index.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/scmutil.py

CHANGE DETAILS

diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py
--- a/mercurial/scmutil.py
+++ b/mercurial/scmutil.py
@@ -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:



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


More information about the Mercurial-devel mailing list