1 % help |
1 % help |
2 keyword extension - keyword expansion in local repositories |
2 keyword extension - keyword expansion in local repositories |
3 This extension expands RCS/CVS-like or self-customized $Keywords$ |
3 This extension expands RCS/CVS-like or self-customized $Keywords$ |
4 in the text files selected by your configuration. |
4 in tracked text files selected by your configuration. |
5 Keywords are only expanded in local repositories and not logged by |
5 Keywords are only expanded in local repositories and not stored in |
6 Mercurial internally. The mechanism can be regarded as a convenience |
6 the change history. The mechanism can be regarded as a convenience |
7 for the current user or archive distribution. |
7 for the current user 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 |
9 hgrc files. |
9 of hgrc files. |
10 Example: |
10 Example: |
11 [extensions] |
|
12 hgext.keyword = |
|
13 [keyword] |
11 [keyword] |
14 # expand keywords in every python file except those matching "x*" |
12 # expand keywords in every python file except those matching "x*" |
15 **.py = |
13 **.py = |
16 x* = ignore |
14 x* = ignore |
17 Note: the more specific you are in your [keyword] filename patterns |
15 Note: the more specific you are in your filename patterns |
18 the less you lose speed in huge repos. |
16 the less you lose speed in huge repos. |
19 For a [keywordmaps] template mapping and expansion demonstration |
17 For [keywordmaps] template mapping and expansion demonstration and |
20 run "hg kwdemo". |
18 control run "hg kwdemo". |
21 An additional date template filter {date|utcdate} is provided. |
19 An additional date template filter {date|utcdate} is provided. |
22 You can replace the default template mappings with customized keywords |
20 The default template mappings (view with "hg kwdemo -d") can be replaced |
23 and templates of your choice. |
21 with customized keywords and templates. |
24 Again, run "hg kwdemo" to control the results of your config changes. |
22 Again, run "hg kwdemo" to control the results of your config changes. |
25 When you change keyword configuration, especially the active keywords, |
23 Before changing/disabling active keywords, run "hg kwshrink" to avoid |
26 and do not want to store expanded keywords in change history, run |
24 the risk of inadvertedly storing expanded keywords in the change history. |
27 "hg kwshrink", and then change configuration. |
25 Expansions spanning more than one line and incremental expansions, |
28 Expansions spanning more than one line and incremental exapansions |
26 like CVS' $Log$, are not supported. A keyword template map |
29 (like CVS' $Log$) are not supported. A keyword template map |
|
30 "Log = {desc}" expands to the first line of the changeset description. |
27 "Log = {desc}" expands to the first line of the changeset description. |
31 Caveat: "hg import" fails if the patch context contains an active |
28 Caveat: "hg import" fails if the patch context contains an active |
32 keyword. In that case run "hg kwshrink", reimport, and then |
29 keyword. In that case run "hg kwshrink", reimport, and then |
33 "hg kwexpand". |
30 "hg kwexpand". |
34 Or, better, use bundle/unbundle to share changes. |
31 Or, better, use bundle/unbundle to share changes. |
35 list of commands (use "hg help -v keyword" to show aliases and global options): |
|
36 kwdemo print [keywordmaps] configuration and an expansion example |
32 kwdemo print [keywordmaps] configuration and an expansion example |
37 kwexpand expand keywords in working directory |
33 kwexpand expand keywords in working directory |
38 kwshrink revert expanded keywords in working directory |
34 kwshrink revert expanded keywords in working directory |
39 % hg kwdemo |
35 % hg kwdemo |
|
36 [extensions] |
|
37 hgext.keyword = |
40 [keyword] |
38 [keyword] |
41 demo.txt = |
39 demo.txt = |
42 [keywordmaps] |
40 [keywordmaps] |
43 RCSFile = {file|basename},v |
41 RCSFile = {file|basename},v |
44 Author = {author|user} |
42 Author = {author|user} |