Patchwork D8520: status: also support for `traversedir` callback in the Rust fast-path

login
register
mail settings
Submitter phabricator
Date May 12, 2020, 11:51 a.m.
Message ID <differential-rev-PHID-DREV-soqhuwkrk5hjgp3ac3cd-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/46306/
State Superseded
Headers show

Comments

phabricator - May 12, 2020, 11:51 a.m.
Alphare created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  Repeating the performance numbers from the `hg-core` change:
  
  Running `hg clean/purge` on Netbeans' repo (100k files):
  
         | No-op | 30% unknown
    --------------------------
    Rust | 1.0s  | 1.67s
    C    | 2.0s  | 2.87s

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1107,6 +1107,7 @@ 
             unknown,
             warnings,
             bad,
+            traversed,
         ) = rustmod.status(
             self._map._rustmap,
             matcher,
@@ -1117,7 +1118,13 @@ 
             bool(list_clean),
             bool(list_ignored),
             bool(list_unknown),
+            bool(matcher.traversedir),
         )
+
+        if matcher.traversedir:
+            for dir in traversed:
+                matcher.traversedir(dir)
+
         if self._ui.warn:
             for item in warnings:
                 if isinstance(item, tuple):
@@ -1193,8 +1200,6 @@ 
             use_rust = False
         elif sparse.enabled:
             use_rust = False
-        elif match.traversedir is not None:
-            use_rust = False
         elif not isinstance(match, allowed_matchers):
             # Some matchers have yet to be implemented
             use_rust = False