Mercurial > public > mercurial-scm > hg
diff mercurial/match.py @ 51566:b32c3146ec34 stable
match: fix the "visitdir" method on "rootfilesin" matchers
This fixes just the Python side, the fix for the rust side will follow shortly.
author | Arseniy Alekseyev <aalekseyev@janestreet.com> |
---|---|
date | Fri, 12 Apr 2024 15:39:21 +0100 |
parents | 1c31b343e514 |
children | ea3343104f07 |
line wrap: on
line diff
--- a/mercurial/match.py Fri Apr 12 14:21:14 2024 +0100 +++ b/mercurial/match.py Fri Apr 12 15:39:21 2024 +0100 @@ -638,7 +638,10 @@ super(patternmatcher, self).__init__(badfn) kindpats.sort() + roots, dirs, parents = _rootsdirsandparents(kindpats) self._files = _explicitfiles(kindpats) + self._dirs_explicit = set(dirs) + self._dirs = parents self._prefix = _prefix(kindpats) self._pats, self._matchfn = _buildmatch(kindpats, b'$', root) @@ -647,14 +650,14 @@ return True return self._matchfn(fn) - @propertycache - def _dirs(self): - return set(pathutil.dirs(self._fileset)) - def visitdir(self, dir): if self._prefix and dir in self._fileset: return b'all' - return dir in self._dirs or path_or_parents_in_set(dir, self._fileset) + return ( + dir in self._dirs + or path_or_parents_in_set(dir, self._fileset) + or path_or_parents_in_set(dir, self._dirs_explicit) + ) def visitchildrenset(self, dir): ret = self.visitdir(dir) @@ -1461,7 +1464,7 @@ allgroups = [] regexps = [] exact = set() - for (kind, pattern, _source) in kindpats: + for kind, pattern, _source in kindpats: if kind == b'filepath': exact.add(pattern) continue