Mercurial > hg-stable
changeset 35740:06a757b9e334
minifileset: unify handling of symbol and string patterns
They must be identical for fileset compatibility.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Sun, 14 Jan 2018 13:33:56 +0900 |
parents | 9eb5c400f488 |
children | 73432eee0ac4 |
files | mercurial/minifileset.py |
diffstat | 1 files changed, 3 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/minifileset.py Sun Jan 14 13:28:20 2018 +0900 +++ b/mercurial/minifileset.py Sun Jan 14 13:33:56 2018 +0900 @@ -17,7 +17,7 @@ if not tree: raise error.ParseError(_("missing argument")) op = tree[0] - if op == 'symbol': + if op in {'symbol', 'string'}: name = fileset.getstring(tree, _('invalid file pattern')) if name.startswith('**'): # file extension test, ex. "**.tar.gz" ext = name[2:] @@ -25,17 +25,14 @@ if c in '*{}[]?/\\': raise error.ParseError(_('reserved character: %s') % c) return lambda n, s: n.endswith(ext) - raise error.ParseError(_('invalid symbol: %s') % name) - elif op == 'string': # TODO: teach fileset about 'path:', so that this can be a symbol and # not require quoting. - name = fileset.getstring(tree, _('invalid path literal')) - if name.startswith('path:'): # directory or full path test + elif name.startswith('path:'): # directory or full path test p = name[5:] # prefix pl = len(p) f = lambda n, s: n.startswith(p) and (len(n) == pl or n[pl] == '/') return f - raise error.ParseError(_("invalid string"), + raise error.ParseError(_("unsupported file pattern"), hint=_('paths must be prefixed with "path:"')) elif op == 'or': func1 = _compile(tree[1])