##// END OF EJS Templates
help: adding a topic on flags...
Rodrigo Damazio Bovendorp -
r35036:b0262b25 default
parent child Browse files
Show More
@@ -0,0 +1,104 b''
1 Most Mercurial commands accept various flags.
2
3 Flag names
4 ==========
5
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
8 any command - those are seen in :hg:`help -v`, and can be specified before or
9 after the command.
10
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
13 name is equivalent and has the same effect.
14
15 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::
17
18 hg commit -ei
19
20 If any of the bundled flags takes a value (i.e. is not a boolean), it must be
21 last, followed by the value::
22
23 hg commit -im 'Message'
24
25 Flag types
26 ==========
27
28 Mercurial command-line flags can be strings, numbers, booleans, or lists of
29 strings.
30
31 Specifying flag values
32 ======================
33
34 The following syntaxes are allowed, assuming a flag 'flagname' with short name
35 'f'::
36
37 --flagname=foo
38 --flagname foo
39 -f foo
40 -ffoo
41
42 This syntax applies to all non-boolean flags (strings, numbers or lists).
43
44 Specifying boolean flags
45 ========================
46
47 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
49 false::
50
51 hg commit --interactive
52 hg commit --no-interactive
53
54 Specifying list flags
55 =====================
56
57 List flags take multiple values. To specify them, pass the flag multiple times::
58
59 hg files --include mercurial --include tests
60
61 Setting flag defaults
62 =====================
63
64 In order to set a default value for a flag in an hgrc file, it is recommended to
65 use aliases::
66
67 [alias]
68 commit = commit --interactive
69
70 For more information on hgrc files, see :hg:`help config`.
71
72 Overriding flags on the command line
73 ====================================
74
75 If the same non-list flag is specified multiple times on the command line, the
76 latest specification is used::
77
78 hg commit -m "Ignored value" -m "Used value"
79
80 This includes the use of aliases - e.g., if one has::
81
82 [alias]
83 committemp = commit -m "Ignored value"
84
85 then the following command will override that -m::
86
87 hg committemp -m "Used value"
88
89 Overriding flag defaults
90 ========================
91
92 Every flag has a default value, and you may also set your own defaults in hgrc
93 as described above.
94 Except for list flags, defaults can be overridden on the command line simply by
95 specifying the flag in that location.
96
97 Hidden flags
98 ============
99
100 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,
102 add the --verbose flag for the help command::
103
104 hg help --verbose commit
@@ -23,6 +23,7 b''
23 <File Name="environment.txt" />
23 <File Name="environment.txt" />
24 <File Name="extensions.txt" />
24 <File Name="extensions.txt" />
25 <File Name="filesets.txt" />
25 <File Name="filesets.txt" />
26 <File Name="flags.txt" />
26 <File Name="glossary.txt" />
27 <File Name="glossary.txt" />
27 <File Name="hgignore.txt" />
28 <File Name="hgignore.txt" />
28 <File Name="hgweb.txt" />
29 <File Name="hgweb.txt" />
@@ -226,6 +226,7 b' helptable = sorted(['
226 (['color'], _("Colorizing Outputs"), loaddoc('color')),
226 (['color'], _("Colorizing Outputs"), loaddoc('color')),
227 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
227 (["config", "hgrc"], _("Configuration Files"), loaddoc('config')),
228 (["dates"], _("Date Formats"), loaddoc('dates')),
228 (["dates"], _("Date Formats"), loaddoc('dates')),
229 (["flags"], _("Command-line flags"), loaddoc('flags')),
229 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
230 (["patterns"], _("File Name Patterns"), loaddoc('patterns')),
230 (['environment', 'env'], _('Environment Variables'),
231 (['environment', 'env'], _('Environment Variables'),
231 loaddoc('environment')),
232 loaddoc('environment')),
@@ -355,6 +355,7 b' Testing -h/--help:'
355 environment Environment Variables
355 environment Environment Variables
356 extensions Using Additional Features
356 extensions Using Additional Features
357 filesets Specifying File Sets
357 filesets Specifying File Sets
358 flags Command-line flags
358 glossary Glossary
359 glossary Glossary
359 hgignore Syntax for Mercurial Ignore Files
360 hgignore Syntax for Mercurial Ignore Files
360 hgweb Configuring hgweb
361 hgweb Configuring hgweb
@@ -439,6 +440,7 b' Testing -h/--help:'
439 environment Environment Variables
440 environment Environment Variables
440 extensions Using Additional Features
441 extensions Using Additional Features
441 filesets Specifying File Sets
442 filesets Specifying File Sets
443 flags Command-line flags
442 glossary Glossary
444 glossary Glossary
443 hgignore Syntax for Mercurial Ignore Files
445 hgignore Syntax for Mercurial Ignore Files
444 hgweb Configuring hgweb
446 hgweb Configuring hgweb
@@ -110,6 +110,7 b' Short help:'
110 environment Environment Variables
110 environment Environment Variables
111 extensions Using Additional Features
111 extensions Using Additional Features
112 filesets Specifying File Sets
112 filesets Specifying File Sets
113 flags Command-line flags
113 glossary Glossary
114 glossary Glossary
114 hgignore Syntax for Mercurial Ignore Files
115 hgignore Syntax for Mercurial Ignore Files
115 hgweb Configuring hgweb
116 hgweb Configuring hgweb
@@ -188,6 +189,7 b' Short help:'
188 environment Environment Variables
189 environment Environment Variables
189 extensions Using Additional Features
190 extensions Using Additional Features
190 filesets Specifying File Sets
191 filesets Specifying File Sets
192 flags Command-line flags
191 glossary Glossary
193 glossary Glossary
192 hgignore Syntax for Mercurial Ignore Files
194 hgignore Syntax for Mercurial Ignore Files
193 hgweb Configuring hgweb
195 hgweb Configuring hgweb
@@ -865,6 +867,7 b' Test that default list of commands omits'
865 environment Environment Variables
867 environment Environment Variables
866 extensions Using Additional Features
868 extensions Using Additional Features
867 filesets Specifying File Sets
869 filesets Specifying File Sets
870 flags Command-line flags
868 glossary Glossary
871 glossary Glossary
869 hgignore Syntax for Mercurial Ignore Files
872 hgignore Syntax for Mercurial Ignore Files
870 hgweb Configuring hgweb
873 hgweb Configuring hgweb
@@ -2013,6 +2016,13 b' Dish up an empty repo; serve it cold.'
2013 Specifying File Sets
2016 Specifying File Sets
2014 </td></tr>
2017 </td></tr>
2015 <tr><td>
2018 <tr><td>
2019 <a href="/help/flags">
2020 flags
2021 </a>
2022 </td><td>
2023 Command-line flags
2024 </td></tr>
2025 <tr><td>
2016 <a href="/help/glossary">
2026 <a href="/help/glossary">
2017 glossary
2027 glossary
2018 </a>
2028 </a>
@@ -1581,6 +1581,10 b' help/ shows help topics'
1581 "topic": "filesets"
1581 "topic": "filesets"
1582 },
1582 },
1583 {
1583 {
1584 "summary": "Command-line flags",
1585 "topic": "flags"
1586 },
1587 {
1584 "summary": "Glossary",
1588 "summary": "Glossary",
1585 "topic": "glossary"
1589 "topic": "glossary"
1586 },
1590 },
General Comments 0
You need to be logged in to leave comments. Login now