Mercurial > hg
annotate mercurial/help/flags.txt @ 41673:1db5ae4b0dda
cleanup: prefer matchmod.{always,never}() over accessing matchers directly
We have these factory methods so we should use them.
Differential Revision: https://phab.mercurial-scm.org/D5927
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Sun, 10 Feb 2019 14:16:37 -0800 |
parents | b0262b25ab48 |
children |
rev | line source |
---|---|
35045
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
1 Most Mercurial commands accept various flags. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
2 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
3 Flag names |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
4 ========== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
5 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
6 Flags for each command are listed in :hg:`help` for that command. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
7 Additionally, some flags, such as --repository, are global and can be used with |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
8 any command - those are seen in :hg:`help -v`, and can be specified before or |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
9 after the command. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
10 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
11 Every flag has at least a long name, such as --repository. Some flags may also |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
12 have a short one-letter name, such as the equivalent -R. Using the short or long |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
13 name is equivalent and has the same effect. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
14 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
15 Flags that have a short name can also be bundled together - for instance, to |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
16 specify both --edit (short -e) and --interactive (short -i), one could use:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
17 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
18 hg commit -ei |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
19 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
20 If any of the bundled flags takes a value (i.e. is not a boolean), it must be |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
21 last, followed by the value:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
22 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
23 hg commit -im 'Message' |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
24 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
25 Flag types |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
26 ========== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
27 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
28 Mercurial command-line flags can be strings, numbers, booleans, or lists of |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
29 strings. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
30 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
31 Specifying flag values |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
32 ====================== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
33 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
34 The following syntaxes are allowed, assuming a flag 'flagname' with short name |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
35 'f':: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
36 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
37 --flagname=foo |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
38 --flagname foo |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
39 -f foo |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
40 -ffoo |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
41 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
42 This syntax applies to all non-boolean flags (strings, numbers or lists). |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
43 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
44 Specifying boolean flags |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
45 ======================== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
46 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
47 Boolean flags do not take a value parameter. To specify a boolean, use the flag |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
48 name to set it to true, or the same name prefixed with 'no-' to set it to |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
49 false:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
50 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
51 hg commit --interactive |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
52 hg commit --no-interactive |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
53 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
54 Specifying list flags |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
55 ===================== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
56 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
57 List flags take multiple values. To specify them, pass the flag multiple times:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
58 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
59 hg files --include mercurial --include tests |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
60 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
61 Setting flag defaults |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
62 ===================== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
63 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
64 In order to set a default value for a flag in an hgrc file, it is recommended to |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
65 use aliases:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
66 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
67 [alias] |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
68 commit = commit --interactive |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
69 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
70 For more information on hgrc files, see :hg:`help config`. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
71 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
72 Overriding flags on the command line |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
73 ==================================== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
74 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
75 If the same non-list flag is specified multiple times on the command line, the |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
76 latest specification is used:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
77 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
78 hg commit -m "Ignored value" -m "Used value" |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
79 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
80 This includes the use of aliases - e.g., if one has:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
81 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
82 [alias] |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
83 committemp = commit -m "Ignored value" |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
84 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
85 then the following command will override that -m:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
86 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
87 hg committemp -m "Used value" |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
88 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
89 Overriding flag defaults |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
90 ======================== |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
91 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
92 Every flag has a default value, and you may also set your own defaults in hgrc |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
93 as described above. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
94 Except for list flags, defaults can be overridden on the command line simply by |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
95 specifying the flag in that location. |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
96 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
97 Hidden flags |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
98 ============ |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
99 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
100 Some flags are not shown in a command's help by default - specifically, those |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
101 that are deemed to be experimental, deprecated or advanced. To show all flags, |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
102 add the --verbose flag for the help command:: |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
103 |
b0262b25ab48
help: adding a topic on flags
Rodrigo Damazio Bovendorp <rdamazio@google.com>
parents:
diff
changeset
|
104 hg help --verbose commit |