comparison mercurial/context.py @ 31446:084050d76e4f

context: explicitly tests for None Changeset 9e57033fec0c removed the mutable default value, but did not explicitly tested for None. Such implicit testing can introduce semantic and performance issue. We move to an explicit testing for None as recommended by PEP8: https://www.python.org/dev/peps/pep-0008/#programming-recommendations
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Wed, 15 Mar 2017 15:33:24 -0700
parents 9e57033fec0c
children 0e7a6279ff6e
comparison
equal deleted inserted replaced
31445:ac7aa96e4cd8 31446:084050d76e4f
298 ''' 298 '''
299 return subrepo.subrepo(self, path, allowwdir=True) 299 return subrepo.subrepo(self, path, allowwdir=True)
300 300
301 def match(self, pats=None, include=None, exclude=None, default='glob', 301 def match(self, pats=None, include=None, exclude=None, default='glob',
302 listsubrepos=False, badfn=None): 302 listsubrepos=False, badfn=None):
303 if pats is None:
304 pats = []
303 r = self._repo 305 r = self._repo
304 return matchmod.match(r.root, r.getcwd(), pats or [], 306 return matchmod.match(r.root, r.getcwd(), pats,
305 include, exclude, default, 307 include, exclude, default,
306 auditor=r.nofsauditor, ctx=self, 308 auditor=r.nofsauditor, ctx=self,
307 listsubrepos=listsubrepos, badfn=badfn) 309 listsubrepos=listsubrepos, badfn=badfn)
308 310
309 def diff(self, ctx2=None, match=None, **opts): 311 def diff(self, ctx2=None, match=None, **opts):
1515 self._repo.dirstate.normallookup(dest) 1517 self._repo.dirstate.normallookup(dest)
1516 self._repo.dirstate.copy(source, dest) 1518 self._repo.dirstate.copy(source, dest)
1517 1519
1518 def match(self, pats=None, include=None, exclude=None, default='glob', 1520 def match(self, pats=None, include=None, exclude=None, default='glob',
1519 listsubrepos=False, badfn=None): 1521 listsubrepos=False, badfn=None):
1522 if pats is None:
1523 pats = []
1520 r = self._repo 1524 r = self._repo
1521 1525
1522 # Only a case insensitive filesystem needs magic to translate user input 1526 # Only a case insensitive filesystem needs magic to translate user input
1523 # to actual case in the filesystem. 1527 # to actual case in the filesystem.
1524 if not util.fscasesensitive(r.root): 1528 if not util.fscasesensitive(r.root):
1525 return matchmod.icasefsmatcher(r.root, r.getcwd(), pats or [], 1529 return matchmod.icasefsmatcher(r.root, r.getcwd(), pats,
1526 include, exclude, default, r.auditor, 1530 include, exclude, default, r.auditor,
1527 self, listsubrepos=listsubrepos, 1531 self, listsubrepos=listsubrepos,
1528 badfn=badfn) 1532 badfn=badfn)
1529 return matchmod.match(r.root, r.getcwd(), pats or [], 1533 return matchmod.match(r.root, r.getcwd(), pats,
1530 include, exclude, default, 1534 include, exclude, default,
1531 auditor=r.auditor, ctx=self, 1535 auditor=r.auditor, ctx=self,
1532 listsubrepos=listsubrepos, badfn=badfn) 1536 listsubrepos=listsubrepos, badfn=badfn)
1533 1537
1534 def _filtersuspectsymlink(self, files): 1538 def _filtersuspectsymlink(self, files):