# HG changeset patch # User Yuya Nishihara # Date 1515904436 -32400 # Node ID 06a757b9e334f5a85616639d937bd61434f9a707 # Parent 9eb5c400f488832b2fb0f9c5bb10e97b08362600 minifileset: unify handling of symbol and string patterns They must be identical for fileset compatibility. diff -r 9eb5c400f488 -r 06a757b9e334 mercurial/minifileset.py --- 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])