Patchwork D7531: rust-matchers: add support for `explicitmatcher` in `dirstate.status`

login
register
mail settings
Submitter phabricator
Date Nov. 29, 2019, 6:22 p.m.
Message ID <differential-rev-PHID-DREV-ybgxi6eq3r3nil6hmeff-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/43538/
State Superseded
Headers show

Comments

phabricator - Nov. 29, 2019, 6:22 p.m.
Alphare created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: Alphare, #hg-reviewers
Cc: mercurial-devel
phabricator - Dec. 10, 2019, 7:15 p.m.
martinvonz added a comment.


  Did you mean s/explicitmatcher/exactmatcher/ in the description? Also, I thought you called it FileMatcher instead. What's the difference?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7531/new/

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

To: Alphare, #hg-reviewers
Cc: martinvonz, mercurial-devel
phabricator - Dec. 11, 2019, 8:40 a.m.
Alphare added a comment.


  Yes, I meant `exactmatcher` indeed. 
  `FileMatcher` is meant for the Rust side of things, I do not intend to rename it in Python because it is a minor change that would make a lot of noise for bikeshedding. Do you think that would be a good idea?

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D7531/new/

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

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

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -1095,11 +1095,14 @@ 
         dmap.preload()
 
         use_rust = True
+
+        allowed_matchers = (matchmod.alwaysmatcher, matchmod.exactmatcher)
+
         if rustmod is None:
             use_rust = False
         elif subrepos:
             use_rust = False
-        if bool(listunknown):
+        elif bool(listunknown):
             # Pathauditor does not exist yet in Rust, unknown files
             # can't be trusted.
             use_rust = False
@@ -1107,7 +1110,7 @@ 
             # Rust has no ignore mechanism yet, so don't use Rust for
             # commands that need ignore.
             use_rust = False
-        elif not match.always():
+        elif not isinstance(match, allowed_matchers):
             # Matchers have yet to be implemented
             use_rust = False
 
@@ -1135,6 +1138,7 @@ 
                 clean,
             ) = rustmod.status(
                 dmap._rustmap,
+                match,
                 self._rootdir,
                 bool(listclean),
                 self._lastnormaltime,