Show More
@@ -1,104 +1,106 b'' | |||||
1 | Most Mercurial commands accept various flags. |
|
1 | Most Mercurial commands accept various flags. | |
2 |
|
2 | |||
3 | Flag names |
|
3 | Flag names | |
4 | ========== |
|
4 | ========== | |
5 |
|
5 | |||
6 | Flags for each command are listed in :hg:`help` for that command. |
|
6 | Flags for each command are listed in :hg:`help` for that command. | |
7 | Additionally, some flags, such as --repository, are global and can be used with |
|
7 | Additionally, some flags, such as --repository, are global and can be used with | |
8 | any command - those are seen in :hg:`help -v`, and can be specified before or |
|
8 | any command - those are seen in :hg:`help -v`, and can be specified before or | |
9 | after the command. |
|
9 | after the command. | |
10 |
|
10 | |||
11 | Every flag has at least a long name, such as --repository. Some flags may also |
|
11 | Every flag has at least a long name, such as --repository. Some flags may also | |
12 | have a short one-letter name, such as the equivalent -R. Using the short or long |
|
12 | have a short one-letter name, such as the equivalent -R. Using the short or long | |
13 | name is equivalent and has the same effect. |
|
13 | name is equivalent and has the same effect. The long name may be abbreviated to | |
|
14 | any unambiguous prefix. For example, :hg:`commit --amend` can be abbreviated | |||
|
15 | to :hg:`commit --am`. | |||
14 |
|
16 | |||
15 | Flags that have a short name can also be bundled together - for instance, to |
|
17 | Flags that have a short name can also be bundled together - for instance, to | |
16 | specify both --edit (short -e) and --interactive (short -i), one could use:: |
|
18 | specify both --edit (short -e) and --interactive (short -i), one could use:: | |
17 |
|
19 | |||
18 | hg commit -ei |
|
20 | hg commit -ei | |
19 |
|
21 | |||
20 | If any of the bundled flags takes a value (i.e. is not a boolean), it must be |
|
22 | If any of the bundled flags takes a value (i.e. is not a boolean), it must be | |
21 | last, followed by the value:: |
|
23 | last, followed by the value:: | |
22 |
|
24 | |||
23 | hg commit -im 'Message' |
|
25 | hg commit -im 'Message' | |
24 |
|
26 | |||
25 | Flag types |
|
27 | Flag types | |
26 | ========== |
|
28 | ========== | |
27 |
|
29 | |||
28 | Mercurial command-line flags can be strings, numbers, booleans, or lists of |
|
30 | Mercurial command-line flags can be strings, numbers, booleans, or lists of | |
29 | strings. |
|
31 | strings. | |
30 |
|
32 | |||
31 | Specifying flag values |
|
33 | Specifying flag values | |
32 | ====================== |
|
34 | ====================== | |
33 |
|
35 | |||
34 | The following syntaxes are allowed, assuming a flag 'flagname' with short name |
|
36 | The following syntaxes are allowed, assuming a flag 'flagname' with short name | |
35 | 'f':: |
|
37 | 'f':: | |
36 |
|
38 | |||
37 | --flagname=foo |
|
39 | --flagname=foo | |
38 | --flagname foo |
|
40 | --flagname foo | |
39 | -f foo |
|
41 | -f foo | |
40 | -ffoo |
|
42 | -ffoo | |
41 |
|
43 | |||
42 | This syntax applies to all non-boolean flags (strings, numbers or lists). |
|
44 | This syntax applies to all non-boolean flags (strings, numbers or lists). | |
43 |
|
45 | |||
44 | Specifying boolean flags |
|
46 | Specifying boolean flags | |
45 | ======================== |
|
47 | ======================== | |
46 |
|
48 | |||
47 | Boolean flags do not take a value parameter. To specify a boolean, use the flag |
|
49 | Boolean flags do not take a value parameter. To specify a boolean, use the flag | |
48 | name to set it to true, or the same name prefixed with 'no-' to set it to |
|
50 | name to set it to true, or the same name prefixed with 'no-' to set it to | |
49 | false:: |
|
51 | false:: | |
50 |
|
52 | |||
51 | hg commit --interactive |
|
53 | hg commit --interactive | |
52 | hg commit --no-interactive |
|
54 | hg commit --no-interactive | |
53 |
|
55 | |||
54 | Specifying list flags |
|
56 | Specifying list flags | |
55 | ===================== |
|
57 | ===================== | |
56 |
|
58 | |||
57 | List flags take multiple values. To specify them, pass the flag multiple times:: |
|
59 | List flags take multiple values. To specify them, pass the flag multiple times:: | |
58 |
|
60 | |||
59 | hg files --include mercurial --include tests |
|
61 | hg files --include mercurial --include tests | |
60 |
|
62 | |||
61 | Setting flag defaults |
|
63 | Setting flag defaults | |
62 | ===================== |
|
64 | ===================== | |
63 |
|
65 | |||
64 | In order to set a default value for a flag in an hgrc file, it is recommended to |
|
66 | In order to set a default value for a flag in an hgrc file, it is recommended to | |
65 | use aliases:: |
|
67 | use aliases:: | |
66 |
|
68 | |||
67 | [alias] |
|
69 | [alias] | |
68 | commit = commit --interactive |
|
70 | commit = commit --interactive | |
69 |
|
71 | |||
70 | For more information on hgrc files, see :hg:`help config`. |
|
72 | For more information on hgrc files, see :hg:`help config`. | |
71 |
|
73 | |||
72 | Overriding flags on the command line |
|
74 | Overriding flags on the command line | |
73 | ==================================== |
|
75 | ==================================== | |
74 |
|
76 | |||
75 | If the same non-list flag is specified multiple times on the command line, the |
|
77 | If the same non-list flag is specified multiple times on the command line, the | |
76 | latest specification is used:: |
|
78 | latest specification is used:: | |
77 |
|
79 | |||
78 | hg commit -m "Ignored value" -m "Used value" |
|
80 | hg commit -m "Ignored value" -m "Used value" | |
79 |
|
81 | |||
80 | This includes the use of aliases - e.g., if one has:: |
|
82 | This includes the use of aliases - e.g., if one has:: | |
81 |
|
83 | |||
82 | [alias] |
|
84 | [alias] | |
83 | committemp = commit -m "Ignored value" |
|
85 | committemp = commit -m "Ignored value" | |
84 |
|
86 | |||
85 | then the following command will override that -m:: |
|
87 | then the following command will override that -m:: | |
86 |
|
88 | |||
87 | hg committemp -m "Used value" |
|
89 | hg committemp -m "Used value" | |
88 |
|
90 | |||
89 | Overriding flag defaults |
|
91 | Overriding flag defaults | |
90 | ======================== |
|
92 | ======================== | |
91 |
|
93 | |||
92 | Every flag has a default value, and you may also set your own defaults in hgrc |
|
94 | Every flag has a default value, and you may also set your own defaults in hgrc | |
93 | as described above. |
|
95 | as described above. | |
94 | Except for list flags, defaults can be overridden on the command line simply by |
|
96 | Except for list flags, defaults can be overridden on the command line simply by | |
95 | specifying the flag in that location. |
|
97 | specifying the flag in that location. | |
96 |
|
98 | |||
97 | Hidden flags |
|
99 | Hidden flags | |
98 | ============ |
|
100 | ============ | |
99 |
|
101 | |||
100 | Some flags are not shown in a command's help by default - specifically, those |
|
102 | Some flags are not shown in a command's help by default - specifically, those | |
101 | that are deemed to be experimental, deprecated or advanced. To show all flags, |
|
103 | that are deemed to be experimental, deprecated or advanced. To show all flags, | |
102 | add the --verbose flag for the help command:: |
|
104 | add the --verbose flag for the help command:: | |
103 |
|
105 | |||
104 | hg help --verbose commit |
|
106 | hg help --verbose commit |
General Comments 0
You need to be logged in to leave comments.
Login now