[PATCH 3 of 3] match: also optimize "path:." to use alwaysmatcher

Martin von Zweigbergk martinvonz at google.com
Mon Jul 10 02:44:43 EDT 2017


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1499667389 25200
#      Sun Jul 09 23:16:29 2017 -0700
# Node ID 42df87114da18c9fcd52bcee2f7ab42e3ce76f63
# Parent  3d7c440a43018d9a4b8c181131de86b57c50d2ce
match: also optimize "path:." to use alwaysmatcher

The default pattern type from the command line is "relpath:". It's
probably rare, but if the user explicitly types "path:." instead of
just "." (or "relpath:."), let's allow for the same fast paths (which
is the main benefit of using an alwaysmatcher).

diff --git a/mercurial/match.py b/mercurial/match.py
--- a/mercurial/match.py
+++ b/mercurial/match.py
@@ -81,7 +81,7 @@
     'relpath:.' does.
     """
     for kind, pat, source in kindpats:
-        if pat != '' or kind not in ['relpath', 'glob']:
+        if pat != '' or kind not in ['path', 'relpath', 'glob']:
             return False
     return True
 


More information about the Mercurial-devel mailing list