Mercurial > public > mercurial-scm > hg-stable
diff mercurial/context.py @ 32748: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 | a722c8e17363 |
children | dc7efa2826e4 |
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