dirstate: remove the python-side whitelist of allowed matchers
authorArseniy Alekseyev <aalekseyev@janestreet.com>
Fri, 26 Apr 2024 19:10:35 +0100
changeset 51626 865efc020c33
parent 51625 aa23b19e6da4
child 51628 33bcb1dd4101
dirstate: remove the python-side whitelist of allowed matchers This whitelist is too permissive because it allows matchers that contain disallowed ones deep inside, for example through `intersectionmatcher`. It is also too restrictive because it doesn't pass through some of the matchers we support, such as `patternmatcher`. It's also unnecessary because unsupported matchers raise `FallbackError` and we fall back anyway. Making this change makes more of the tests use rust code path, and therefore subtly change behavior. For example, rust status in largefiles repos seems to have strange behavior.
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Fri Apr 26 18:53:02 2024 +0100
+++ b/mercurial/dirstate.py	Fri Apr 26 19:10:35 2024 +0100
@@ -1639,16 +1639,6 @@
 
         use_rust = True
 
-        allowed_matchers = (
-            matchmod.alwaysmatcher,
-            matchmod.differencematcher,
-            matchmod.exactmatcher,
-            matchmod.includematcher,
-            matchmod.intersectionmatcher,
-            matchmod.nevermatcher,
-            matchmod.unionmatcher,
-        )
-
         if rustmod is None:
             use_rust = False
         elif self._checkcase:
@@ -1656,9 +1646,6 @@
             use_rust = False
         elif subrepos:
             use_rust = False
-        elif not isinstance(match, allowed_matchers):
-            # Some matchers have yet to be implemented
-            use_rust = False
 
         # Get the time from the filesystem so we can disambiguate files that
         # appear modified in the present or future.