Show More
@@ -11,6 +11,7 b' from .i18n import _' | |||||
11 | from . import ( |
|
11 | from . import ( | |
12 | error, |
|
12 | error, | |
13 | fileset, |
|
13 | fileset, | |
|
14 | pycompat, | |||
14 | ) |
|
15 | ) | |
15 |
|
16 | |||
16 | def _compile(tree): |
|
17 | def _compile(tree): | |
@@ -21,14 +22,15 b' def _compile(tree):' | |||||
21 | name = fileset.getpattern(tree, {'path'}, _('invalid file pattern')) |
|
22 | name = fileset.getpattern(tree, {'path'}, _('invalid file pattern')) | |
22 | if name.startswith('**'): # file extension test, ex. "**.tar.gz" |
|
23 | if name.startswith('**'): # file extension test, ex. "**.tar.gz" | |
23 | ext = name[2:] |
|
24 | ext = name[2:] | |
24 | for c in ext: |
|
25 | for c in pycompat.bytestr(ext): | |
25 | if c in '*{}[]?/\\': |
|
26 | if c in '*{}[]?/\\': | |
26 | raise error.ParseError(_('reserved character: %s') % c) |
|
27 | raise error.ParseError(_('reserved character: %s') % c) | |
27 | return lambda n, s: n.endswith(ext) |
|
28 | return lambda n, s: n.endswith(ext) | |
28 | elif name.startswith('path:'): # directory or full path test |
|
29 | elif name.startswith('path:'): # directory or full path test | |
29 | p = name[5:] # prefix |
|
30 | p = name[5:] # prefix | |
30 | pl = len(p) |
|
31 | pl = len(p) | |
31 |
f = lambda n, s: n.startswith(p) and (len(n) == pl |
|
32 | f = lambda n, s: n.startswith(p) and (len(n) == pl | |
|
33 | or n[pl:pl + 1] == '/') | |||
32 | return f |
|
34 | return f | |
33 | raise error.ParseError(_("unsupported file pattern: %s") % name, |
|
35 | raise error.ParseError(_("unsupported file pattern: %s") % name, | |
34 | hint=_('paths must be prefixed with "path:"')) |
|
36 | hint=_('paths must be prefixed with "path:"')) |
General Comments 0
You need to be logged in to leave comments.
Login now