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

login
register
mail settings
Submitter phabricator
Date June 5, 2019, 7:05 p.m.
Message ID <0b7b4c55deda51e37ac3b0f8e7b282eb@localhost.localdomain>
Download mbox | patch
Permalink /patch/40322/
State Not Applicable
Headers show

Comments

phabricator - June 5, 2019, 7:05 p.m.
Alphare updated this revision to Diff 15343.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6395?vs=15162&id=15343

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

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




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

Patch

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: