changeset 49364:c2092612c424

sparse: use the rust code even when sparse is present With rust supporting more matcher types, we can now take this route in the sparse case too.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Sat, 11 Jun 2022 00:26:25 +0200
parents bd3519dc6741
children 288de6f5d724 79b2c98ab7b4
files mercurial/dirstate.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/dirstate.py	Fri Jun 10 23:19:04 2022 +0200
+++ b/mercurial/dirstate.py	Sat Jun 11 00:26:25 2022 +0200
@@ -1178,6 +1178,10 @@
         return results
 
     def _rust_status(self, matcher, list_clean, list_ignored, list_unknown):
+        if self._sparsematchfn is not None:
+            em = matchmod.exact(matcher.files())
+            sm = matchmod.unionmatcher([self._sparsematcher, em])
+            matcher = matchmod.intersectmatchers(matcher, sm)
         # Force Rayon (Rust parallelism library) to respect the number of
         # workers. This is a temporary workaround until Rust code knows
         # how to read the config file.
@@ -1296,8 +1300,6 @@
             use_rust = False
         elif subrepos:
             use_rust = False
-        elif self._sparsematchfn is not None:
-            use_rust = False
         elif not isinstance(match, allowed_matchers):
             # Some matchers have yet to be implemented
             use_rust = False