D6395: rust-dirstate: call new "dirs" rust implementation from Python

Alphare (Raphaël Gomès) phabricator at mercurial-scm.org
Fri May 17 10:10:55 UTC 2019


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

REVISION SUMMARY
  This is a simple module attribute replacement, will take precedence over the
  Python and C implementations.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -53,6 +53,12 @@
     stringutil,
 )
 
+try:
+    from . import rustext
+    rustext.__name__  # force actual import (see hgdemandimport)
+except ImportError:
+    rustext = None
+
 base85 = policy.importmod(r'base85')
 osutil = policy.importmod(r'osutil')
 parsers = policy.importmod(r'parsers')
@@ -3204,6 +3210,9 @@
 if safehasattr(parsers, 'dirs'):
     dirs = parsers.dirs
 
+if rustext is not None:
+    dirs = rustext.dirstate.Dirs
+
 def finddirs(path):
     pos = path.rfind('/')
     while pos != -1:



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


More information about the Mercurial-devel mailing list