Mercurial > hg
changeset 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 | c94c1aeb35fb |
children | c8177792fef6 |
files | mercurial/context.py mercurial/match.py |
diffstat | 2 files changed, 1 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/context.py Tue Jun 06 11:16:38 2017 -0400 +++ b/mercurial/context.py Thu Jun 08 22:18:17 2017 -0700 @@ -301,8 +301,6 @@ def match(self, pats=None, include=None, exclude=None, default='glob', listsubrepos=False, badfn=None): - if pats is None: - pats = [] r = self._repo return matchmod.match(r.root, r.getcwd(), pats, include, exclude, default, @@ -1701,8 +1699,6 @@ def match(self, pats=None, include=None, exclude=None, default='glob', listsubrepos=False, badfn=None): - if pats is None: - pats = [] r = self._repo # Only a case insensitive filesystem needs magic to translate user input
--- 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