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