sparse: use the rust code even when sparse is present
authorPierre-Yves David <pierre-yves.david@octobus.net>
Sat, 11 Jun 2022 00:26:25 +0200
changeset 49361 c2092612c424
parent 49360 bd3519dc6741
child 49365 79b2c98ab7b4
child 49366 288de6f5d724
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.
mercurial/dirstate.py
--- 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