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