| 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>keyword</title> |
| 8 |
<link rel="stylesheet" href="../style.css" type="text/css" /> |
| 9 |
</head> |
| 10 |
<body> |
| 11 |
<div class="document" id="keyword"> |
| 12 |
<span id="ext-keyword"></span> |
| 13 |
<h1 class="title">keyword</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="#description" id="toc-entry-1">Description</a></li> |
| 19 |
<li><a class="reference internal" href="#commands" id="toc-entry-2">Commands</a><ul> |
| 20 |
<li><a class="reference internal" href="#uncategorized-commands" id="toc-entry-3">Uncategorized commands</a></li> |
| 21 |
</ul> |
| 22 |
</li> |
| 23 |
</ul> |
| 24 |
</div> |
| 25 |
<p>expand keywords in tracked files</p> |
| 26 |
<div class="section" id="description"> |
| 27 |
<h1><a class="toc-backref" href="#contents">Description</a></h1> |
| 28 |
<p>This extension expands RCS/CVS-like or self-customized $Keywords$ in |
| 29 |
tracked text files selected by your configuration.</p> |
| 30 |
<p>Keywords are only expanded in local repositories and not stored in the |
| 31 |
change history. The mechanism can be regarded as a convenience for the |
| 32 |
current user or for archive distribution.</p> |
| 33 |
<p>Keywords expand to the changeset data pertaining to the latest change |
| 34 |
relative to the working directory parent of each file.</p> |
| 35 |
<p>Configuration is done in the [keyword], [keywordset] and [keywordmaps] |
| 36 |
sections of hgrc files.</p> |
| 37 |
<p>Example:</p> |
| 38 |
<pre class="literal-block"> |
| 39 |
[keyword] |
| 40 |
# expand keywords in every python file except those matching "x*" |
| 41 |
**.py = |
| 42 |
x* = ignore |
| 43 |
|
| 44 |
[keywordset] |
| 45 |
# prefer svn- over cvs-like default keywordmaps |
| 46 |
svn = True |
| 47 |
</pre> |
| 48 |
<div class="admonition note"> |
| 49 |
<p class="first admonition-title">Note</p> |
| 50 |
<p class="last">The more specific you are in your filename patterns the less you |
| 51 |
lose speed in huge repositories.</p> |
| 52 |
</div> |
| 53 |
<p>For [keywordmaps] template mapping and expansion demonstration and |
| 54 |
control run <a class="reference external" href="hg-kwdemo.html"><tt class="docutils literal">hg kwdemo</tt></a>. See <a class="reference external" href="hg.1.html#templates"><tt class="docutils literal">hg help templates</tt></a> for a list of |
| 55 |
available templates and filters.</p> |
| 56 |
<p>Three additional date template filters are provided:</p> |
| 57 |
<table class="docutils field-list" frame="void" rules="none"> |
| 58 |
<col class="field-name" /> |
| 59 |
<col class="field-body" /> |
| 60 |
<tbody valign="top"> |
| 61 |
<tr class="field"><th class="field-name"><tt class="docutils literal">utcdate</tt>:</th><td class="field-body">"2006/09/18 15:13:13"</td> |
| 62 |
</tr> |
| 63 |
<tr class="field"><th class="field-name"><tt class="docutils literal">svnutcdate</tt>:</th><td class="field-body">"2006-09-18 15:13:13Z"</td> |
| 64 |
</tr> |
| 65 |
<tr class="field"><th class="field-name"><tt class="docutils literal">svnisodate</tt>:</th><td class="field-body">"2006-09-18 08:13:13 -700 (Mon, 18 Sep 2006)"</td> |
| 66 |
</tr> |
| 67 |
</tbody> |
| 68 |
</table> |
| 69 |
<p>The default template mappings (view with <a class="reference external" href="hg-kwdemo.html"><tt class="docutils literal">hg kwdemo <span class="pre">-d</span></tt></a>) can be |
| 70 |
replaced with customized keywords and templates. Again, run |
| 71 |
<a class="reference external" href="hg-kwdemo.html"><tt class="docutils literal">hg kwdemo</tt></a> to control the results of your configuration changes.</p> |
| 72 |
<p>Before changing/disabling active keywords, you must run <a class="reference external" href="hg-kwshrink.html"><tt class="docutils literal">hg kwshrink</tt></a> |
| 73 |
to avoid storing expanded keywords in the change history.</p> |
| 74 |
<p>To force expansion after enabling it, or a configuration change, run |
| 75 |
<a class="reference external" href="hg-kwexpand.html"><tt class="docutils literal">hg kwexpand</tt></a>.</p> |
| 76 |
<p>Expansions spanning more than one line and incremental expansions, |
| 77 |
like CVS' $Log$, are not supported. A keyword template map "Log = |
| 78 |
{desc}" expands to the first line of the changeset description.</p> |
| 79 |
</div> |
| 80 |
<div class="section" id="commands"> |
| 81 |
<h1><a class="toc-backref" href="#contents">Commands</a></h1> |
| 82 |
<div class="section" id="uncategorized-commands"> |
| 83 |
<h2><a class="toc-backref" href="#contents">Uncategorized commands</a></h2> |
| 84 |
<div class="section" id="kwdemo"> |
| 85 |
<h3>kwdemo</h3> |
| 86 |
<p>print [keywordmaps] configuration and an expansion example:</p> |
| 87 |
<pre class="literal-block"> |
| 88 |
hg kwdemo [-d] [-f RCFILE] [TEMPLATEMAP]... |
| 89 |
</pre> |
| 90 |
<p>Show current, custom, or default keyword template maps and their |
| 91 |
expansions.</p> |
| 92 |
<p>Extend the current configuration by specifying maps as arguments |
| 93 |
and using -f/--rcfile to source an external hgrc file.</p> |
| 94 |
<p>Use -d/--default to disable current configuration.</p> |
| 95 |
<p>See <a class="reference external" href="hg.1.html#templates"><tt class="docutils literal">hg help templates</tt></a> for information on templates and filters.</p> |
| 96 |
<p>Options:</p> |
| 97 |
<table class="docutils option-list" frame="void" rules="none"> |
| 98 |
<col class="option" /> |
| 99 |
<col class="description" /> |
| 100 |
<tbody valign="top"> |
| 101 |
<tr><td class="option-group"> |
| 102 |
<kbd><span class="option">-d</span>, <span class="option">--default</span></kbd></td> |
| 103 |
<td>show default keyword template maps</td></tr> |
| 104 |
<tr><td class="option-group" colspan="2"> |
| 105 |
<kbd><span class="option">-f</span>, <span class="option">--rcfile <var><FILE></var></span></kbd></td> |
| 106 |
</tr> |
| 107 |
<tr><td> </td><td>read maps from rcfile</td></tr> |
| 108 |
</tbody> |
| 109 |
</table> |
| 110 |
</div> |
| 111 |
<div class="section" id="kwexpand"> |
| 112 |
<h3>kwexpand</h3> |
| 113 |
<p>expand keywords in the working directory:</p> |
| 114 |
<pre class="literal-block"> |
| 115 |
hg kwexpand [OPTION]... [FILE]... |
| 116 |
</pre> |
| 117 |
<p>Run after (re)enabling keyword expansion.</p> |
| 118 |
<p>kwexpand refuses to run if given files contain local changes.</p> |
| 119 |
<p>Options:</p> |
| 120 |
<table class="docutils option-list" frame="void" rules="none"> |
| 121 |
<col class="option" /> |
| 122 |
<col class="description" /> |
| 123 |
<tbody valign="top"> |
| 124 |
<tr><td class="option-group" colspan="2"> |
| 125 |
<kbd><span class="option">-I</span>, <span class="option">--include <var><PATTERN[+]></var></span></kbd></td> |
| 126 |
</tr> |
| 127 |
<tr><td> </td><td>include names matching the given patterns</td></tr> |
| 128 |
<tr><td class="option-group" colspan="2"> |
| 129 |
<kbd><span class="option">-X</span>, <span class="option">--exclude <var><PATTERN[+]></var></span></kbd></td> |
| 130 |
</tr> |
| 131 |
<tr><td> </td><td>exclude names matching the given patterns</td></tr> |
| 132 |
</tbody> |
| 133 |
</table> |
| 134 |
<p>[+] marked option can be specified multiple times</p> |
| 135 |
</div> |
| 136 |
<div class="section" id="kwfiles"> |
| 137 |
<h3>kwfiles</h3> |
| 138 |
<p>show files configured for keyword expansion:</p> |
| 139 |
<pre class="literal-block"> |
| 140 |
hg kwfiles [OPTION]... [FILE]... |
| 141 |
</pre> |
| 142 |
<p>List which files in the working directory are matched by the |
| 143 |
[keyword] configuration patterns.</p> |
| 144 |
<p>Useful to prevent inadvertent keyword expansion and to speed up |
| 145 |
execution by including only files that are actual candidates for |
| 146 |
expansion.</p> |
| 147 |
<p>See <a class="reference external" href="ext-keyword.html"><tt class="docutils literal">hg help keyword</tt></a> on how to construct patterns both for |
| 148 |
inclusion and exclusion of files.</p> |
| 149 |
<p>With -A/--all and -v/--verbose the codes used to show the status |
| 150 |
of files are:</p> |
| 151 |
<pre class="literal-block"> |
| 152 |
K = keyword expansion candidate |
| 153 |
k = keyword expansion candidate (not tracked) |
| 154 |
I = ignored |
| 155 |
i = ignored (not tracked) |
| 156 |
</pre> |
| 157 |
<p>Options:</p> |
| 158 |
<table class="docutils option-list" frame="void" rules="none"> |
| 159 |
<col class="option" /> |
| 160 |
<col class="description" /> |
| 161 |
<tbody valign="top"> |
| 162 |
<tr><td class="option-group"> |
| 163 |
<kbd><span class="option">-A</span>, <span class="option">--all</span></kbd></td> |
| 164 |
<td>show keyword status flags of all files</td></tr> |
| 165 |
<tr><td class="option-group"> |
| 166 |
<kbd><span class="option">-i</span>, <span class="option">--ignore</span></kbd></td> |
| 167 |
<td>show files excluded from expansion</td></tr> |
| 168 |
<tr><td class="option-group"> |
| 169 |
<kbd><span class="option">-u</span>, <span class="option">--unknown</span></kbd></td> |
| 170 |
<td>only show unknown (not tracked) files</td></tr> |
| 171 |
<tr><td class="option-group" colspan="2"> |
| 172 |
<kbd><span class="option">-I</span>, <span class="option">--include <var><PATTERN[+]></var></span></kbd></td> |
| 173 |
</tr> |
| 174 |
<tr><td> </td><td>include names matching the given patterns</td></tr> |
| 175 |
<tr><td class="option-group" colspan="2"> |
| 176 |
<kbd><span class="option">-X</span>, <span class="option">--exclude <var><PATTERN[+]></var></span></kbd></td> |
| 177 |
</tr> |
| 178 |
<tr><td> </td><td>exclude names matching the given patterns</td></tr> |
| 179 |
</tbody> |
| 180 |
</table> |
| 181 |
<p>[+] marked option can be specified multiple times</p> |
| 182 |
</div> |
| 183 |
<div class="section" id="kwshrink"> |
| 184 |
<h3>kwshrink</h3> |
| 185 |
<p>revert expanded keywords in the working directory:</p> |
| 186 |
<pre class="literal-block"> |
| 187 |
hg kwshrink [OPTION]... [FILE]... |
| 188 |
</pre> |
| 189 |
<p>Must be run before changing/disabling active keywords.</p> |
| 190 |
<p>kwshrink refuses to run if given files contain local changes.</p> |
| 191 |
<p>Options:</p> |
| 192 |
<table class="docutils option-list" frame="void" rules="none"> |
| 193 |
<col class="option" /> |
| 194 |
<col class="description" /> |
| 195 |
<tbody valign="top"> |
| 196 |
<tr><td class="option-group" colspan="2"> |
| 197 |
<kbd><span class="option">-I</span>, <span class="option">--include <var><PATTERN[+]></var></span></kbd></td> |
| 198 |
</tr> |
| 199 |
<tr><td> </td><td>include names matching the given patterns</td></tr> |
| 200 |
<tr><td class="option-group" colspan="2"> |
| 201 |
<kbd><span class="option">-X</span>, <span class="option">--exclude <var><PATTERN[+]></var></span></kbd></td> |
| 202 |
</tr> |
| 203 |
<tr><td> </td><td>exclude names matching the given patterns</td></tr> |
| 204 |
</tbody> |
| 205 |
</table> |
| 206 |
<p>[+] marked option can be specified multiple times</p> |
| 207 |
</div> |
| 208 |
</div> |
| 209 |
</div> |
| 210 |
</div> |
| 211 |
</body> |
| 212 |
</html> |