1 % help |
|
2 keyword extension - keyword expansion in local repositories |
|
3 |
|
4 This extension expands RCS/CVS-like or self-customized keywords in |
|
5 the text files selected by your configuration. |
|
6 |
|
7 Keywords are only expanded in local repositories and not logged by |
|
8 Mercurial internally. The mechanism can be regarded as a convenience |
|
9 for the current user and may be turned off anytime. |
|
10 |
|
11 The exansion works in 2 modes: |
|
12 1) working mode: substitution takes place on every commit and |
|
13 update of the working repository. |
|
14 2) archive mode: substitution is only triggered by "hg archive". |
|
15 |
|
16 Caveat: "hg import" might fail if the patches were exported from a |
|
17 repo with a different/no keyword setup, whereas "hg unbundle" is |
|
18 safe. |
|
19 |
|
20 Configuration is done in the [keyword] and [keywordmaps] sections of |
|
21 hgrc files. |
|
22 |
|
23 Example: |
|
24 [keyword] |
|
25 # filename patterns for expansion are configured in this section |
|
26 **.py = ## expand keywords in all python files |
|
27 x* = ignore ## but ignore files matching "x*" |
|
28 ** = archive ## keywords in all textfiles are expanded |
|
29 ## when creating a distribution |
|
30 y* = noarchive ## keywords in files matching "y*" are not expanded |
|
31 ## on archive creation |
|
32 ... |
|
33 [keywordmaps] |
|
34 # custom hg template maps _replace_ the CVS-like default ones |
|
35 HGdate = {date|rfc822date} |
|
36 lastlog = {desc} ## same as {desc|firstline} in this context |
|
37 checked in by = {author} |
|
38 ... |
|
39 |
|
40 If no [keywordmaps] are configured the extension falls back on the |
|
41 following defaults: |
|
42 |
|
43 Revision: changeset id |
|
44 Author: username |
|
45 Date: %Y/%m/%d %H:%M:%S ## [UTC] |
|
46 RCSFile: basename,v |
|
47 Source: /path/to/basename,v |
|
48 Id: basename,v csetid %Y/%m/%d %H:%M:%S username |
|
49 Header: /path/to/basename,v csetid %Y/%m/%d %H:%M:%S username |
|
50 |
|
51 no commands defined |
|
52 % cat |
|
53 expand $Id$ |
|
54 ignore $Id$ |
|
55 archive $Id$ |
|
56 expand $Id$ |
|
57 % default keyword expansion |
|
58 % commit |
|
59 adding a |
|
60 adding b |
|
61 adding c |
|
62 adding sym |
|
63 a |
|
64 b |
|
65 c |
|
66 sym |
|
67 overwriting a expanding keywords |
|
68 % status |
|
69 % cat |
|
70 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
71 ignore $Id$ |
|
72 archive $Id$ |
|
73 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
74 % hg cat |
|
75 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
76 archive $Id$ |
|
77 ignore $Id$ |
|
78 a |
|
79 % update |
|
80 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
81 % cat |
|
82 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
83 ignore $Id$ |
|
84 archive $Id$ |
|
85 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
86 % archive |
|
87 % cat |
|
88 expand $Id$ |
|
89 ignore $Id$ |
|
90 archive $Id: c,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
91 a |
|
92 % custom keyword expansion |
|
93 % cat |
|
94 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
95 ignore $Id$ |
|
96 archive $Id$ |
|
97 expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
|
98 % hg cat |
|
99 expand $Id: a 99e97605039e Thu, 01 Jan 1970 00:00:00 +0000 user $ |
|
100 archive $Id$ |
|
101 ignore $Id$ |
|
102 a |
|
103 % commit |
|
104 a |
|
105 overwriting a expanding keywords |
|
106 % status |
|
107 % cat |
|
108 expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
|
109 $Xinfo: User Name <user@example.com>: firstline $ |
|
110 ignore $Id$ |
|
111 archive $Id$ |
|
112 expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
|
113 $Xinfo: User Name <user@example.com>: firstline $ |
|
114 % hg cat |
|
115 expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
|
116 $Xinfo: User Name <user@example.com>: firstline $ |
|
117 archive $Id$ |
|
118 ignore $Id$ |
|
119 a |
|
120 requesting all changes |
|
121 adding changesets |
|
122 adding manifests |
|
123 adding file changes |
|
124 added 1 changesets with 4 changes to 4 files |
|
125 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
126 % incoming |
|
127 searching for changes |
|
128 changeset: 1:001dbcdc5258 |
|
129 tag: tip |
|
130 user: User Name <user@example.com> |
|
131 date: Thu Jan 01 00:00:01 1970 +0000 |
|
132 summary: firstline |
|
133 |
|
134 % switch off expansion |
|
135 % cat |
|
136 expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
|
137 $Xinfo: User Name <user@example.com>: firstline $ |
|
138 ignore $Id$ |
|
139 archive $Id$ |
|
140 expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
|
141 $Xinfo: User Name <user@example.com>: firstline $ |
|
142 % hg cat |
|
143 expand $Id$ |
|
144 $Xinfo$ |
|
145 archive $Id$ |
|
146 ignore $Id$ |
|
147 a |
|
148 % update |
|
149 4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
150 % cat |
|
151 expand $Id$ |
|
152 $Xinfo$ |
|
153 ignore $Id$ |
|
154 archive $Id$ |
|
155 expand $Id$ |
|
156 $Xinfo$ |
|