diff mercurial/match.py @ 32728:3e8eb6d84a5c

match: allow pats to be None match.match already interprets "!bool(patterns)" as matching everything (but includes and excludes still apply). We might as well allow None, which lets us simplify some callers a bit. I originally wrote this patch while trying to change match.match(patterns=[]) to mean to match no patterns. This patch is one step towards that goal. I'm not sure it'll be worth the effort to go all the way there, but I think this patch still makes sense on its own.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 08 Jun 2017 22:18:17 -0700
parents 783394c0c978
children a9808bd1449e
line wrap: on
line diff
--- a/mercurial/match.py	Tue Jun 06 11:16:38 2017 -0400
+++ b/mercurial/match.py	Thu Jun 08 22:18:17 2017 -0700
@@ -85,7 +85,7 @@
             return False
     return True
 
-def match(root, cwd, patterns, include=None, exclude=None, default='glob',
+def match(root, cwd, patterns=None, include=None, exclude=None, default='glob',
           exact=False, auditor=None, ctx=None, listsubrepos=False, warn=None,
           badfn=None, icasefs=False):
     """build an object to match a set of file patterns