Show More
@@ -11,7 +11,7 b' from i18n import _' | |||||
11 |
|
11 | |||
12 | class match(object): |
|
12 | class match(object): | |
13 | def __init__(self, root, cwd, patterns, include=[], exclude=[], |
|
13 | def __init__(self, root, cwd, patterns, include=[], exclude=[], | |
14 | default='glob', exact=False): |
|
14 | default='glob', exact=False, auditor=None): | |
15 | """build an object to match a set of file patterns |
|
15 | """build an object to match a set of file patterns | |
16 |
|
16 | |||
17 | arguments: |
|
17 | arguments: | |
@@ -39,14 +39,16 b' class match(object):' | |||||
39 | self._anypats = bool(include or exclude) |
|
39 | self._anypats = bool(include or exclude) | |
40 |
|
40 | |||
41 | if include: |
|
41 | if include: | |
42 |
im = _buildmatch(_normalize(include, 'glob', root, cwd), |
|
42 | im = _buildmatch(_normalize(include, 'glob', root, cwd, auditor), | |
|
43 | '(?:/|$)') | |||
43 | if exclude: |
|
44 | if exclude: | |
44 |
em = _buildmatch(_normalize(exclude, 'glob', root, cwd), |
|
45 | em = _buildmatch(_normalize(exclude, 'glob', root, cwd, auditor), | |
|
46 | '(?:/|$)') | |||
45 | if exact: |
|
47 | if exact: | |
46 | self._files = patterns |
|
48 | self._files = patterns | |
47 | pm = self.exact |
|
49 | pm = self.exact | |
48 | elif patterns: |
|
50 | elif patterns: | |
49 | pats = _normalize(patterns, default, root, cwd) |
|
51 | pats = _normalize(patterns, default, root, cwd, auditor) | |
50 | self._files = _roots(pats) |
|
52 | self._files = _roots(pats) | |
51 | self._anypats = self._anypats or _anypats(pats) |
|
53 | self._anypats = self._anypats or _anypats(pats) | |
52 | pm = _buildmatch(pats, '$') |
|
54 | pm = _buildmatch(pats, '$') | |
@@ -218,11 +220,11 b' def _buildmatch(pats, tail):' | |||||
218 | raise util.Abort(_("invalid pattern (%s): %s") % (k, p)) |
|
220 | raise util.Abort(_("invalid pattern (%s): %s") % (k, p)) | |
219 | raise util.Abort(_("invalid pattern")) |
|
221 | raise util.Abort(_("invalid pattern")) | |
220 |
|
222 | |||
221 | def _normalize(names, default, root, cwd): |
|
223 | def _normalize(names, default, root, cwd, auditor): | |
222 | pats = [] |
|
224 | pats = [] | |
223 | for kind, name in [_patsplit(p, default) for p in names]: |
|
225 | for kind, name in [_patsplit(p, default) for p in names]: | |
224 | if kind in ('glob', 'relpath'): |
|
226 | if kind in ('glob', 'relpath'): | |
225 | name = util.canonpath(root, cwd, name) |
|
227 | name = util.canonpath(root, cwd, name, auditor) | |
226 | elif kind in ('relglob', 'path'): |
|
228 | elif kind in ('relglob', 'path'): | |
227 | name = util.normpath(name) |
|
229 | name = util.normpath(name) | |
228 |
|
230 |
General Comments 0
You need to be logged in to leave comments.
Login now