Show More
@@ -20,6 +20,11 b' across path separators and ``{a,b}`` to ' | |||||
20 | To use a Perl/Python regular expression, start a name with ``re:``. |
|
20 | To use a Perl/Python regular expression, start a name with ``re:``. | |
21 | Regexp pattern matching is anchored at the root of the repository. |
|
21 | Regexp pattern matching is anchored at the root of the repository. | |
22 |
|
22 | |||
|
23 | To read name patterns from a file, use ``listfile:`` or ``listfile0:``. | |||
|
24 | The latter expects null delimited patterns while the former expects line | |||
|
25 | feeds. Each string read from the file is itself treated as a file | |||
|
26 | pattern. | |||
|
27 | ||||
23 | Plain examples:: |
|
28 | Plain examples:: | |
24 |
|
29 | |||
25 | path:foo/bar a name bar in a directory named foo in the root |
|
30 | path:foo/bar a name bar in a directory named foo in the root | |
@@ -39,3 +44,8 b' Glob examples::' | |||||
39 | Regexp examples:: |
|
44 | Regexp examples:: | |
40 |
|
45 | |||
41 | re:.*\.c$ any name ending in ".c", anywhere in the repository |
|
46 | re:.*\.c$ any name ending in ".c", anywhere in the repository | |
|
47 | ||||
|
48 | File examples:: | |||
|
49 | ||||
|
50 | listfile:list.txt read list from list.txt with one file pattern per line | |||
|
51 | listfile0:list.txt read list from list.txt with null byte delimiters |
@@ -161,7 +161,8 b' def _patsplit(pat, default):' | |||||
161 | actual pattern.""" |
|
161 | actual pattern.""" | |
162 | if ':' in pat: |
|
162 | if ':' in pat: | |
163 | kind, val = pat.split(':', 1) |
|
163 | kind, val = pat.split(':', 1) | |
164 |
if kind in ('re', 'glob', 'path', 'relglob', 'relpath', 'relre' |
|
164 | if kind in ('re', 'glob', 'path', 'relglob', 'relpath', 'relre', | |
|
165 | 'listfile', 'listfile0'): | |||
165 | return kind, val |
|
166 | return kind, val | |
166 | return default, pat |
|
167 | return default, pat | |
167 |
|
168 | |||
@@ -270,6 +271,15 b' def _normalize(names, default, root, cwd' | |||||
270 | name = util.canonpath(root, cwd, name, auditor) |
|
271 | name = util.canonpath(root, cwd, name, auditor) | |
271 | elif kind in ('relglob', 'path'): |
|
272 | elif kind in ('relglob', 'path'): | |
272 | name = util.normpath(name) |
|
273 | name = util.normpath(name) | |
|
274 | elif kind in ('listfile', 'listfile0'): | |||
|
275 | delimiter = kind == 'listfile0' and '\0' or '\n' | |||
|
276 | try: | |||
|
277 | files = open(name, 'r').read().split(delimiter) | |||
|
278 | files = [f for f in files if f] | |||
|
279 | except EnvironmentError: | |||
|
280 | raise util.Abort(_("unable to read file list (%s)") % name) | |||
|
281 | pats += _normalize(files, default, root, cwd, auditor) | |||
|
282 | continue | |||
273 |
|
283 | |||
274 | pats.append((kind, name)) |
|
284 | pats.append((kind, name)) | |
275 | return pats |
|
285 | return pats |
General Comments 0
You need to be logged in to leave comments.
Login now