Mercurial > public > mercurial-scm > hg-stable
diff mercurial/minifileset.py @ 38844:d82c4d42b615
fileset: flatten 'or' nodes to unnest unionmatchers
This also makes it easier to compile a union of basic patterns into a single
regexp pattern.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sat, 21 Jul 2018 15:23:56 +0900 |
parents | 1500cbe22d53 |
children | b9162ea1b815 |
line wrap: on
line diff
--- a/mercurial/minifileset.py Sat Jul 21 15:14:38 2018 +0900 +++ b/mercurial/minifileset.py Sat Jul 21 15:23:56 2018 +0900 @@ -40,9 +40,8 @@ raise error.ParseError(_("unsupported file pattern: %s") % name, hint=_('paths must be prefixed with "path:"')) elif op == 'or': - func1 = _compile(tree[1]) - func2 = _compile(tree[2]) - return lambda n, s: func1(n, s) or func2(n, s) + funcs = [_compile(x) for x in tree[1:]] + return lambda n, s: any(f(n, s) for f in funcs) elif op == 'and': func1 = _compile(tree[1]) func2 = _compile(tree[2])