# HG changeset patch # User Yuya Nishihara # Date 1528808519 -32400 # Node ID 6467286b829c714f391e4a443ced6dfdd2c532a7 # Parent 9f9ffe5f687c6266580237602e80f987ad4a79aa match: remove ctx argument from code path down to _buildmatch() 'ctx' was there only for filesets. diff -r 9f9ffe5f687c -r 6467286b829c mercurial/match.py --- a/mercurial/match.py Sun Jun 10 16:08:58 2018 +0900 +++ b/mercurial/match.py Tue Jun 12 22:01:59 2018 +0900 @@ -100,7 +100,7 @@ fset, kindpats = _expandsets(kindpats, ctx, listsubrepos) matchers = [] if kindpats: - m = matchercls(root, cwd, kindpats, ctx=ctx, listsubrepos=listsubrepos, + m = matchercls(root, cwd, kindpats, listsubrepos=listsubrepos, badfn=badfn) matchers.append(m) if fset: @@ -410,13 +410,12 @@ class patternmatcher(basematcher): - def __init__(self, root, cwd, kindpats, ctx=None, listsubrepos=False, - badfn=None): + def __init__(self, root, cwd, kindpats, listsubrepos=False, badfn=None): super(patternmatcher, self).__init__(root, cwd, badfn) self._files = _explicitfiles(kindpats) self._prefix = _prefix(kindpats) - self._pats, self.matchfn = _buildmatch(ctx, kindpats, '$', listsubrepos, + self._pats, self.matchfn = _buildmatch(kindpats, '$', listsubrepos, root) @propertycache @@ -441,11 +440,10 @@ class includematcher(basematcher): - def __init__(self, root, cwd, kindpats, ctx=None, listsubrepos=False, - badfn=None): + def __init__(self, root, cwd, kindpats, listsubrepos=False, badfn=None): super(includematcher, self).__init__(root, cwd, badfn) - self._pats, self.matchfn = _buildmatch(ctx, kindpats, '(?:/|$)', + self._pats, self.matchfn = _buildmatch(kindpats, '(?:/|$)', listsubrepos, root) self._prefix = _prefix(kindpats) roots, dirs = _rootsanddirs(kindpats) @@ -842,7 +840,7 @@ return _globre(pat) + globsuffix raise error.ProgrammingError('not a regex pattern: %s:%s' % (kind, pat)) -def _buildmatch(ctx, kindpats, globsuffix, listsubrepos, root): +def _buildmatch(kindpats, globsuffix, listsubrepos, root): '''Return regexp string and a matcher function for kindpats. globsuffix is appended to the regexp of globs.''' matchfuncs = []