comparison mercurial/context.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 a722c8e17363
children dc7efa2826e4
comparison
equal deleted inserted replaced
32727:c94c1aeb35fb 32728:3e8eb6d84a5c
299 ''' 299 '''
300 return subrepo.subrepo(self, path, allowwdir=True) 300 return subrepo.subrepo(self, path, allowwdir=True)
301 301
302 def match(self, pats=None, include=None, exclude=None, default='glob', 302 def match(self, pats=None, include=None, exclude=None, default='glob',
303 listsubrepos=False, badfn=None): 303 listsubrepos=False, badfn=None):
304 if pats is None:
305 pats = []
306 r = self._repo 304 r = self._repo
307 return matchmod.match(r.root, r.getcwd(), pats, 305 return matchmod.match(r.root, r.getcwd(), pats,
308 include, exclude, default, 306 include, exclude, default,
309 auditor=r.nofsauditor, ctx=self, 307 auditor=r.nofsauditor, ctx=self,
310 listsubrepos=listsubrepos, badfn=badfn) 308 listsubrepos=listsubrepos, badfn=badfn)
1699 self._repo.dirstate.normallookup(dest) 1697 self._repo.dirstate.normallookup(dest)
1700 self._repo.dirstate.copy(source, dest) 1698 self._repo.dirstate.copy(source, dest)
1701 1699
1702 def match(self, pats=None, include=None, exclude=None, default='glob', 1700 def match(self, pats=None, include=None, exclude=None, default='glob',
1703 listsubrepos=False, badfn=None): 1701 listsubrepos=False, badfn=None):
1704 if pats is None:
1705 pats = []
1706 r = self._repo 1702 r = self._repo
1707 1703
1708 # Only a case insensitive filesystem needs magic to translate user input 1704 # Only a case insensitive filesystem needs magic to translate user input
1709 # to actual case in the filesystem. 1705 # to actual case in the filesystem.
1710 icasefs = not util.fscasesensitive(r.root) 1706 icasefs = not util.fscasesensitive(r.root)