1 % help |
|
2 keyword extension - expand keywords in tracked files |
|
3 This extension expands RCS/CVS-like or self-customized $Keywords$ in tracked |
|
4 text files selected by your configuration. |
|
5 Keywords are only expanded in local repositories and not stored in the change |
|
6 history. The mechanism can be regarded as a convenience for the current user |
|
7 or for archive distribution. |
|
8 Configuration is done in the [keyword] and [keywordmaps] sections of hgrc |
|
9 files. |
|
10 Example: |
|
11 [keyword] |
|
12 # expand keywords in every python file except those matching "x*" |
|
13 **.py = |
|
14 x* = ignore |
|
15 NOTE: the more specific you are in your filename patterns the less you lose |
|
16 speed in huge repositories. |
|
17 For [keywordmaps] template mapping and expansion demonstration and control run |
|
18 "hg kwdemo". |
|
19 An additional date template filter {date|utcdate} is provided. |
|
20 The default template mappings (view with "hg kwdemo -d") can be replaced with |
|
21 customized keywords and templates. Again, run "hg kwdemo" to control the |
|
22 results of your config changes. |
|
23 Before changing/disabling active keywords, run "hg kwshrink" to avoid the risk |
|
24 of inadvertently storing expanded keywords in the change history. |
|
25 To force expansion after enabling it, or a configuration change, run "hg |
|
26 kwexpand". |
|
27 Also, when committing with the record extension or using mq's qrecord, be |
|
28 aware that keywords cannot be updated. Again, run "hg kwexpand" on the files |
|
29 in question to update keyword expansions after all changes have been checked |
|
30 in. |
|
31 Expansions spanning more than one line and incremental expansions, like CVS' |
|
32 $Log$, are not supported. A keyword template map "Log = {desc}" expands to the |
|
33 first line of the changeset description. |
|
34 Caveat: With Mercurial versions prior to 4574925db5c0 "hg import" might |
|
35 cause rejects if the patch context contains an active keyword. In that |
|
36 case run "hg kwshrink", and then reimport. Or, better, use |
|
37 bundle/unbundle to share changes. |
|
38 kwdemo print [keywordmaps] configuration and an expansion example |
|
39 kwexpand expand keywords in the working directory |
|
40 kwfiles show files configured for keyword expansion |
|
41 kwshrink revert expanded keywords in the working directory |
|
42 % hg kwdemo |
1 % hg kwdemo |
43 [extensions] |
2 [extensions] |
44 hgext.keyword = |
3 hgext.keyword = |
45 [keyword] |
4 [keyword] |
46 * = |
5 * = |