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

login
register
mail settings
Submitter phabricator
Date Dec. 13, 2019, 8:13 p.m.
Message ID <differential-rev-PHID-DREV-4qjdxpdh27c5ngk2x7ay-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43815/
State Superseded
Headers show

Comments

phabricator - Dec. 13, 2019, 8:13 p.m.
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




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

Patch

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: