comparison mercurial/match.py @ 41669:a13268524c25

match: delete unused argument "listsubrepos" from _buildmatch() Seems to have been unused since 9f9ffe5f687c (match: compose 'set:' pattern as matcher, 2018-06-10). Differential Revision: https://phab.mercurial-scm.org/D5924
author Martin von Zweigbergk <martinvonz@google.com>
date Sat, 09 Feb 2019 23:48:19 -0800
parents c4f023b656cf
children c302218a2528
comparison
equal deleted inserted replaced
41668:c4f023b656cf 41669:a13268524c25
101 listsubrepos=False, badfn=None): 101 listsubrepos=False, badfn=None):
102 matchers = [] 102 matchers = []
103 fms, kindpats = _expandsets(root, cwd, kindpats, ctx=ctx, 103 fms, kindpats = _expandsets(root, cwd, kindpats, ctx=ctx,
104 listsubrepos=listsubrepos, badfn=badfn) 104 listsubrepos=listsubrepos, badfn=badfn)
105 if kindpats: 105 if kindpats:
106 m = matchercls(root, cwd, kindpats, listsubrepos=listsubrepos, 106 m = matchercls(root, cwd, kindpats, badfn=badfn)
107 badfn=badfn)
108 matchers.append(m) 107 matchers.append(m)
109 if fms: 108 if fms:
110 matchers.extend(fms) 109 matchers.extend(fms)
111 if not matchers: 110 if not matchers:
112 return nevermatcher(root, cwd, badfn=badfn) 111 return nevermatcher(root, cwd, badfn=badfn)
435 or pycompat.byterepr(self.matchfn)) 434 or pycompat.byterepr(self.matchfn))
436 return '<predicatenmatcher pred=%s>' % s 435 return '<predicatenmatcher pred=%s>' % s
437 436
438 class patternmatcher(basematcher): 437 class patternmatcher(basematcher):
439 438
440 def __init__(self, root, cwd, kindpats, listsubrepos=False, badfn=None): 439 def __init__(self, root, cwd, kindpats, badfn=None):
441 super(patternmatcher, self).__init__(root, cwd, badfn) 440 super(patternmatcher, self).__init__(root, cwd, badfn)
442 441
443 self._files = _explicitfiles(kindpats) 442 self._files = _explicitfiles(kindpats)
444 self._prefix = _prefix(kindpats) 443 self._prefix = _prefix(kindpats)
445 self._pats, self.matchfn = _buildmatch(kindpats, '$', listsubrepos, 444 self._pats, self.matchfn = _buildmatch(kindpats, '$', root)
446 root)
447 445
448 @propertycache 446 @propertycache
449 def _dirs(self): 447 def _dirs(self):
450 return set(util.dirs(self._fileset)) | {'.'} 448 return set(util.dirs(self._fileset)) | {'.'}
451 449
514 def get(self, path): 512 def get(self, path):
515 return self._dirs.get(path, set()) 513 return self._dirs.get(path, set())
516 514
517 class includematcher(basematcher): 515 class includematcher(basematcher):
518 516
519 def __init__(self, root, cwd, kindpats, listsubrepos=False, badfn=None): 517 def __init__(self, root, cwd, kindpats, badfn=None):
520 super(includematcher, self).__init__(root, cwd, badfn) 518 super(includematcher, self).__init__(root, cwd, badfn)
521 519
522 self._pats, self.matchfn = _buildmatch(kindpats, '(?:/|$)', 520 self._pats, self.matchfn = _buildmatch(kindpats, '(?:/|$)', root)
523 listsubrepos, root)
524 self._prefix = _prefix(kindpats) 521 self._prefix = _prefix(kindpats)
525 roots, dirs, parents = _rootsdirsandparents(kindpats) 522 roots, dirs, parents = _rootsdirsandparents(kindpats)
526 # roots are directories which are recursively included. 523 # roots are directories which are recursively included.
527 self._roots = set(roots) 524 self._roots = set(roots)
528 # dirs are directories which are non-recursively included. 525 # dirs are directories which are non-recursively included.
1103 return '.*' + pat 1100 return '.*' + pat
1104 if kind in ('glob', 'rootglob'): 1101 if kind in ('glob', 'rootglob'):
1105 return _globre(pat) + globsuffix 1102 return _globre(pat) + globsuffix
1106 raise error.ProgrammingError('not a regex pattern: %s:%s' % (kind, pat)) 1103 raise error.ProgrammingError('not a regex pattern: %s:%s' % (kind, pat))
1107 1104
1108 def _buildmatch(kindpats, globsuffix, listsubrepos, root): 1105 def _buildmatch(kindpats, globsuffix, root):
1109 '''Return regexp string and a matcher function for kindpats. 1106 '''Return regexp string and a matcher function for kindpats.
1110 globsuffix is appended to the regexp of globs.''' 1107 globsuffix is appended to the regexp of globs.'''
1111 matchfuncs = [] 1108 matchfuncs = []
1112 1109
1113 subincludes, kindpats = _expandsubinclude(kindpats, root) 1110 subincludes, kindpats = _expandsubinclude(kindpats, root)