Show More
@@ -1,78 +1,78 b'' | |||||
1 | Mercurial supports a functional language for selecting a set of |
|
1 | Mercurial supports a functional language for selecting a set of | |
2 | files. |
|
2 | files. | |
3 |
|
3 | |||
4 | Like other file patterns, this pattern type is indicated by a prefix, |
|
4 | Like other file patterns, this pattern type is indicated by a prefix, | |
5 | 'set:'. The language supports a number of predicates which are joined |
|
5 | 'set:'. The language supports a number of predicates which are joined | |
6 | by infix operators. Parenthesis can be used for grouping. |
|
6 | by infix operators. Parenthesis can be used for grouping. | |
7 |
|
7 | |||
8 | Identifiers such as filenames or patterns must be quoted with single |
|
8 | Identifiers such as filenames or patterns must be quoted with single | |
9 | or double quotes if they contain characters outside of |
|
9 | or double quotes if they contain characters outside of | |
10 | ``[.*{}[]?/\_a-zA-Z0-9\x80-\xff]`` or if they match one of the |
|
10 | ``[.*{}[]?/\_a-zA-Z0-9\x80-\xff]`` or if they match one of the | |
11 | predefined predicates. This generally applies to file patterns other |
|
11 | predefined predicates. This generally applies to file patterns other | |
12 | than globs and arguments for predicates. |
|
12 | than globs and arguments for predicates. | |
13 |
|
13 | |||
14 | Special characters can be used in quoted identifiers by escaping them, |
|
14 | Special characters can be used in quoted identifiers by escaping them, | |
15 | e.g., ``\n`` is interpreted as a newline. To prevent them from being |
|
15 | e.g., ``\n`` is interpreted as a newline. To prevent them from being | |
16 | interpreted, strings can be prefixed with ``r``, e.g. ``r'...'``. |
|
16 | interpreted, strings can be prefixed with ``r``, e.g. ``r'...'``. | |
17 |
|
17 | |||
18 | See also :hg:`help patterns`. |
|
18 | See also :hg:`help patterns`. | |
19 |
|
19 | |||
20 | Operators |
|
20 | Operators | |
21 | ========= |
|
21 | ========= | |
22 |
|
22 | |||
23 | There is a single prefix operator: |
|
23 | There is a single prefix operator: | |
24 |
|
24 | |||
25 | ``not x`` |
|
25 | ``not x`` | |
26 | Files not in x. Short form is ``! x``. |
|
26 | Files not in x. Short form is ``! x``. | |
27 |
|
27 | |||
28 | These are the supported infix operators: |
|
28 | These are the supported infix operators: | |
29 |
|
29 | |||
30 | ``x and y`` |
|
30 | ``x and y`` | |
31 | The intersection of files in x and y. Short form is ``x & y``. |
|
31 | The intersection of files in x and y. Short form is ``x & y``. | |
32 |
|
32 | |||
33 | ``x or y`` |
|
33 | ``x or y`` | |
34 | The union of files in x and y. There are two alternative short |
|
34 | The union of files in x and y. There are two alternative short | |
35 | forms: ``x | y`` and ``x + y``. |
|
35 | forms: ``x | y`` and ``x + y``. | |
36 |
|
36 | |||
37 | ``x - y`` |
|
37 | ``x - y`` | |
38 | Files in x but not in y. |
|
38 | Files in x but not in y. | |
39 |
|
39 | |||
40 | Predicates |
|
40 | Predicates | |
41 | ========== |
|
41 | ========== | |
42 |
|
42 | |||
43 | The following predicates are supported: |
|
43 | The following predicates are supported: | |
44 |
|
44 | |||
45 | .. predicatesmarker |
|
45 | .. predicatesmarker | |
46 |
|
46 | |||
47 | Examples |
|
47 | Examples | |
48 | ======== |
|
48 | ======== | |
49 |
|
49 | |||
50 | Some sample queries: |
|
50 | Some sample queries: | |
51 |
|
51 | |||
52 | - Show status of files that appear to be binary in the working directory:: |
|
52 | - Show status of files that appear to be binary in the working directory:: | |
53 |
|
53 | |||
54 | hg status -A "set:binary()" |
|
54 | hg status -A "set:binary()" | |
55 |
|
55 | |||
56 | - Forget files that are in .hgignore but are already tracked:: |
|
56 | - Forget files that are in .hgignore but are already tracked:: | |
57 |
|
57 | |||
58 | hg forget "set:hgignore() and not ignored()" |
|
58 | hg forget "set:hgignore() and not ignored()" | |
59 |
|
59 | |||
60 | - Find text files that contain a string:: |
|
60 | - Find text files that contain a string:: | |
61 |
|
61 | |||
62 | hg files "set:grep(magic) and not binary()" |
|
62 | hg files "set:grep(magic) and not binary()" | |
63 |
|
63 | |||
64 | - Find C files in a non-standard encoding:: |
|
64 | - Find C files in a non-standard encoding:: | |
65 |
|
65 | |||
66 | hg files "set:**.c and not encoding('UTF-8')" |
|
66 | hg files "set:**.c and not encoding('UTF-8')" | |
67 |
|
67 | |||
68 | - Revert copies of large binary files:: |
|
68 | - Revert copies of large binary files:: | |
69 |
|
69 | |||
70 | hg revert "set:copied() and binary() and size('>1M')" |
|
70 | hg revert "set:copied() and binary() and size('>1M')" | |
71 |
|
71 | |||
72 | - Revert files that were added to the working directory:: |
|
72 | - Revert files that were added to the working directory:: | |
73 |
|
73 | |||
74 | hg revert "set:wdir(added())" |
|
74 | hg revert "set:revs('wdir()', added())" | |
75 |
|
75 | |||
76 | - Remove files listed in foo.lst that contain the letter a or b:: |
|
76 | - Remove files listed in foo.lst that contain the letter a or b:: | |
77 |
|
77 | |||
78 | hg remove "set: 'listfile:foo.lst' and (**a* or **b*)" |
|
78 | hg remove "set: 'listfile:foo.lst' and (**a* or **b*)" |
General Comments 0
You need to be logged in to leave comments.
Login now