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