| 1 |
<?xml version="1.0" encoding="utf-8"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| 3 |
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> |
| 4 |
<head> |
| 5 |
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
| 6 |
<meta name="generator" content="Docutils 0.21.2: https://docutils.sourceforge.io/" /> |
| 7 |
<title>Command-line flags</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="command-line-flags"> |
| 12 |
<span id="topic-flags"></span> |
| 13 |
<h1 class="title">Command-line flags</h1> |
| 14 |
|
| 15 |
<div class="contents htmlonly topic" id="contents"> |
| 16 |
<p class="topic-title"><a class="reference internal" href="#top">Contents</a></p> |
| 17 |
<ul class="simple"> |
| 18 |
<li><a class="reference internal" href="#flag-names" id="toc-entry-1">Flag names</a></li> |
| 19 |
<li><a class="reference internal" href="#flag-types" id="toc-entry-2">Flag types</a></li> |
| 20 |
<li><a class="reference internal" href="#specifying-flag-values" id="toc-entry-3">Specifying flag values</a></li> |
| 21 |
<li><a class="reference internal" href="#specifying-boolean-flags" id="toc-entry-4">Specifying boolean flags</a></li> |
| 22 |
<li><a class="reference internal" href="#specifying-list-flags" id="toc-entry-5">Specifying list flags</a></li> |
| 23 |
<li><a class="reference internal" href="#setting-flag-defaults" id="toc-entry-6">Setting flag defaults</a></li> |
| 24 |
<li><a class="reference internal" href="#overriding-flags-on-the-command-line" id="toc-entry-7">Overriding flags on the command line</a></li> |
| 25 |
<li><a class="reference internal" href="#overriding-flag-defaults" id="toc-entry-8">Overriding flag defaults</a></li> |
| 26 |
<li><a class="reference internal" href="#hidden-flags" id="toc-entry-9">Hidden flags</a></li> |
| 27 |
</ul> |
| 28 |
</div> |
| 29 |
<p id="flags">Most Mercurial commands accept various flags.</p> |
| 30 |
<div class="section" id="flag-names"> |
| 31 |
<h1><a class="toc-backref" href="#contents">Flag names</a></h1> |
| 32 |
<p>Flags for each command are listed in <a class="reference external" href="hg-help.html"><tt class="docutils literal">hg help</tt></a> for that command. |
| 33 |
Additionally, some flags, such as --repository, are global and can be used with |
| 34 |
any command - those are seen in <a class="reference external" href="hg.1.html#-v"><tt class="docutils literal">hg help <span class="pre">-v</span></tt></a>, and can be specified before or |
| 35 |
after the command.</p> |
| 36 |
<p>Every flag has at least a long name, such as --repository. Some flags may also |
| 37 |
have a short one-letter name, such as the equivalent -R. Using the short or long |
| 38 |
name is equivalent and has the same effect. The long name may be abbreviated to |
| 39 |
any unambiguous prefix. For example, <a class="reference external" href="hg-commit.html"><tt class="docutils literal">hg commit <span class="pre">--amend</span></tt></a> can be abbreviated |
| 40 |
to <a class="reference external" href="hg-commit.html"><tt class="docutils literal">hg commit <span class="pre">--am</span></tt></a>.</p> |
| 41 |
<p>Flags that have a short name can also be bundled together - for instance, to |
| 42 |
specify both --edit (short -e) and --interactive (short -i), one could use:</p> |
| 43 |
<pre class="literal-block"> |
| 44 |
hg commit -ei |
| 45 |
</pre> |
| 46 |
<p>If any of the bundled flags takes a value (i.e. is not a boolean), it must be |
| 47 |
last, followed by the value:</p> |
| 48 |
<pre class="literal-block"> |
| 49 |
hg commit -im 'Message' |
| 50 |
</pre> |
| 51 |
</div> |
| 52 |
<div class="section" id="flag-types"> |
| 53 |
<h1><a class="toc-backref" href="#contents">Flag types</a></h1> |
| 54 |
<p>Mercurial command-line flags can be strings, numbers, booleans, or lists of |
| 55 |
strings.</p> |
| 56 |
</div> |
| 57 |
<div class="section" id="specifying-flag-values"> |
| 58 |
<h1><a class="toc-backref" href="#contents">Specifying flag values</a></h1> |
| 59 |
<p>The following syntaxes are allowed, assuming a flag 'flagname' with short name |
| 60 |
'f':</p> |
| 61 |
<pre class="literal-block"> |
| 62 |
--flagname=foo |
| 63 |
--flagname foo |
| 64 |
-f foo |
| 65 |
-ffoo |
| 66 |
</pre> |
| 67 |
<p>This syntax applies to all non-boolean flags (strings, numbers or lists).</p> |
| 68 |
</div> |
| 69 |
<div class="section" id="specifying-boolean-flags"> |
| 70 |
<h1><a class="toc-backref" href="#contents">Specifying boolean flags</a></h1> |
| 71 |
<p>Boolean flags do not take a value parameter. To specify a boolean, use the flag |
| 72 |
name to set it to true, or the same name prefixed with 'no-' to set it to |
| 73 |
false:</p> |
| 74 |
<pre class="literal-block"> |
| 75 |
hg commit --interactive |
| 76 |
hg commit --no-interactive |
| 77 |
</pre> |
| 78 |
</div> |
| 79 |
<div class="section" id="specifying-list-flags"> |
| 80 |
<h1><a class="toc-backref" href="#contents">Specifying list flags</a></h1> |
| 81 |
<p>List flags take multiple values. To specify them, pass the flag multiple times:</p> |
| 82 |
<pre class="literal-block"> |
| 83 |
hg files --include mercurial --include tests |
| 84 |
</pre> |
| 85 |
</div> |
| 86 |
<div class="section" id="setting-flag-defaults"> |
| 87 |
<h1><a class="toc-backref" href="#contents">Setting flag defaults</a></h1> |
| 88 |
<p>In order to set a default value for a flag in an hgrc file, it is recommended to |
| 89 |
use aliases:</p> |
| 90 |
<pre class="literal-block"> |
| 91 |
[alias] |
| 92 |
commit = commit --interactive |
| 93 |
</pre> |
| 94 |
<p>For more information on hgrc files, see <a class="reference external" href="hgrc.5.html"><tt class="docutils literal">hg help config</tt></a>.</p> |
| 95 |
</div> |
| 96 |
<div class="section" id="overriding-flags-on-the-command-line"> |
| 97 |
<h1><a class="toc-backref" href="#contents">Overriding flags on the command line</a></h1> |
| 98 |
<p>If the same non-list flag is specified multiple times on the command line, the |
| 99 |
latest specification is used:</p> |
| 100 |
<pre class="literal-block"> |
| 101 |
hg commit -m "Ignored value" -m "Used value" |
| 102 |
</pre> |
| 103 |
<p>This includes the use of aliases - e.g., if one has:</p> |
| 104 |
<pre class="literal-block"> |
| 105 |
[alias] |
| 106 |
committemp = commit -m "Ignored value" |
| 107 |
</pre> |
| 108 |
<p>then the following command will override that -m:</p> |
| 109 |
<pre class="literal-block"> |
| 110 |
hg committemp -m "Used value" |
| 111 |
</pre> |
| 112 |
</div> |
| 113 |
<div class="section" id="overriding-flag-defaults"> |
| 114 |
<h1><a class="toc-backref" href="#contents">Overriding flag defaults</a></h1> |
| 115 |
<p>Every flag has a default value, and you may also set your own defaults in hgrc |
| 116 |
as described above. |
| 117 |
Except for list flags, defaults can be overridden on the command line simply by |
| 118 |
specifying the flag in that location.</p> |
| 119 |
</div> |
| 120 |
<div class="section" id="hidden-flags"> |
| 121 |
<h1><a class="toc-backref" href="#contents">Hidden flags</a></h1> |
| 122 |
<p>Some flags are not shown in a command's help by default - specifically, those |
| 123 |
that are deemed to be experimental, deprecated or advanced. To show all flags, |
| 124 |
add the --verbose flag for the help command:</p> |
| 125 |
<pre class="literal-block"> |
| 126 |
hg help --verbose commit |
| 127 |
</pre> |
| 128 |
</div> |
| 129 |
</div> |
| 130 |
</body> |
| 131 |
</html> |