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