1 % help |
1 % help |
2 keyword extension - keyword expansion in local repositories |
2 keyword extension - keyword expansion in local repositories |
|
3 |
3 This extension expands RCS/CVS-like or self-customized $Keywords$ |
4 This extension expands RCS/CVS-like or self-customized $Keywords$ |
4 in tracked text files selected by your configuration. |
5 in tracked text files selected by your configuration. |
|
6 |
5 Keywords are only expanded in local repositories and not stored in |
7 Keywords are only expanded in local repositories and not stored in |
6 the change history. The mechanism can be regarded as a convenience |
8 the change history. The mechanism can be regarded as a convenience |
7 for the current user or for archive distribution. |
9 for the current user or for archive distribution. |
|
10 |
8 Configuration is done in the [keyword] and [keywordmaps] sections |
11 Configuration is done in the [keyword] and [keywordmaps] sections |
9 of hgrc files. |
12 of hgrc files. |
|
13 |
10 Example: |
14 Example: |
|
15 |
11 [keyword] |
16 [keyword] |
12 # expand keywords in every python file except those matching "x*" |
17 # expand keywords in every python file except those matching "x*" |
13 **.py = |
18 **.py = |
14 x* = ignore |
19 x* = ignore |
|
20 |
15 Note: the more specific you are in your filename patterns |
21 Note: the more specific you are in your filename patterns |
16 the less you lose speed in huge repos. |
22 the less you lose speed in huge repos. |
|
23 |
17 For [keywordmaps] template mapping and expansion demonstration and |
24 For [keywordmaps] template mapping and expansion demonstration and |
18 control run "hg kwdemo". |
25 control run "hg kwdemo". |
|
26 |
19 An additional date template filter {date|utcdate} is provided. |
27 An additional date template filter {date|utcdate} is provided. |
|
28 |
20 The default template mappings (view with "hg kwdemo -d") can be replaced |
29 The default template mappings (view with "hg kwdemo -d") can be replaced |
21 with customized keywords and templates. |
30 with customized keywords and templates. |
22 Again, run "hg kwdemo" to control the results of your config changes. |
31 Again, run "hg kwdemo" to control the results of your config changes. |
|
32 |
23 Before changing/disabling active keywords, run "hg kwshrink" to avoid |
33 Before changing/disabling active keywords, run "hg kwshrink" to avoid |
24 the risk of inadvertedly storing expanded keywords in the change history. |
34 the risk of inadvertedly storing expanded keywords in the change history. |
|
35 |
25 To force expansion after enabling it, or a configuration change, run |
36 To force expansion after enabling it, or a configuration change, run |
26 "hg kwexpand". |
37 "hg kwexpand". |
|
38 |
27 Expansions spanning more than one line and incremental expansions, |
39 Expansions spanning more than one line and incremental expansions, |
28 like CVS' $Log$, are not supported. A keyword template map |
40 like CVS' $Log$, are not supported. A keyword template map |
29 "Log = {desc}" expands to the first line of the changeset description. |
41 "Log = {desc}" expands to the first line of the changeset description. |
|
42 |
30 Caveat: "hg import" fails if the patch context contains an active |
43 Caveat: "hg import" fails if the patch context contains an active |
31 keyword. In that case run "hg kwshrink", and then reimport. |
44 keyword. In that case run "hg kwshrink", and then reimport. |
32 Or, better, use bundle/unbundle to share changes. |
45 Or, better, use bundle/unbundle to share changes. |
|
46 |
|
47 list of commands: |
|
48 |
33 kwdemo print [keywordmaps] configuration and an expansion example |
49 kwdemo print [keywordmaps] configuration and an expansion example |
34 kwexpand expand keywords in working directory |
50 kwexpand expand keywords in working directory |
35 kwfiles print files currently configured for keyword expansion |
51 kwfiles print files currently configured for keyword expansion |
36 kwshrink revert expanded keywords in working directory |
52 kwshrink revert expanded keywords in working directory |
|
53 |
|
54 use "hg -v help keyword" to show aliases and global options |
37 % hg kwdemo |
55 % hg kwdemo |
38 [extensions] |
56 [extensions] |
39 hgext.keyword = |
57 hgext.keyword = |
40 [keyword] |
58 [keyword] |
41 * = |
59 * = |
72 % kwshrink should exit silently in empty/invalid repo |
90 % kwshrink should exit silently in empty/invalid repo |
73 % cat |
91 % cat |
74 expand $Id$ |
92 expand $Id$ |
75 do not process $Id: |
93 do not process $Id: |
76 xxx $ |
94 xxx $ |
|
95 expand $Id$ |
|
96 do not process $Id: |
|
97 xxx $ |
77 ignore $Id$ |
98 ignore $Id$ |
78 % default keyword expansion |
99 % default keyword expansion |
79 % commit |
100 % commit |
80 adding a |
101 adding a |
81 adding b |
102 adding b |
|
103 adding sym |
82 a |
104 a |
83 b |
105 b |
|
106 sym |
84 overwriting a expanding keywords |
107 overwriting a expanding keywords |
85 % status |
108 % status |
86 % identify |
109 % identify |
87 7f0665a496fd |
110 f782df5f9602 |
88 % cat |
111 % cat |
89 expand $Id: a,v 7f0665a496fd 1970/01/01 00:00:00 user $ |
112 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
90 do not process $Id: |
113 do not process $Id: |
91 xxx $ |
114 xxx $ |
92 ignore $Id$ |
115 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
93 % hg cat |
116 do not process $Id: |
94 expand $Id: a,v 7f0665a496fd 1970/01/01 00:00:00 user $ |
117 xxx $ |
95 do not process $Id: |
118 ignore $Id$ |
96 xxx $ |
119 % hg cat |
97 ignore $Id$ |
120 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
|
121 do not process $Id: |
|
122 xxx $ |
|
123 ignore $Id$ |
|
124 a |
98 % touch |
125 % touch |
99 % status |
126 % status |
100 % update |
127 % update |
101 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
128 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
102 % cat |
129 % cat |
103 expand $Id: a,v 7f0665a496fd 1970/01/01 00:00:00 user $ |
130 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
|
131 do not process $Id: |
|
132 xxx $ |
|
133 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
104 do not process $Id: |
134 do not process $Id: |
105 xxx $ |
135 xxx $ |
106 ignore $Id$ |
136 ignore $Id$ |
107 % copy |
137 % copy |
108 % kwfiles added |
138 % kwfiles added |
111 % commit |
141 % commit |
112 c |
142 c |
113 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292 |
143 c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292 |
114 overwriting c expanding keywords |
144 overwriting c expanding keywords |
115 % cat a c |
145 % cat a c |
116 expand $Id: a,v 7f0665a496fd 1970/01/01 00:00:00 user $ |
146 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
117 do not process $Id: |
147 do not process $Id: |
118 xxx $ |
148 xxx $ |
119 expand $Id: c,v 6a127771f5db 1970/01/01 00:00:01 user $ |
149 expand $Id: c,v 0ba462c0f077 1970/01/01 00:00:01 user $ |
120 do not process $Id: |
150 do not process $Id: |
121 xxx $ |
151 xxx $ |
122 % touch copied c after 1 second |
152 % touch copied c after 1 second |
123 % status |
153 % status |
124 % kwfiles |
154 % kwfiles |
125 a |
155 a |
126 c |
156 c |
127 % diff --rev |
157 % diff --rev |
128 diff -r 7f0665a496fd c |
158 diff -r f782df5f9602 c |
129 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
159 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
130 @@ -0,0 +1,3 @@ |
160 @@ -0,0 +1,3 @@ |
131 +expand $Id: c,v 6a127771f5db 1970/01/01 00:00:01 user $ |
161 +expand $Id: c,v 0ba462c0f077 1970/01/01 00:00:01 user $ |
132 +do not process $Id: |
162 +do not process $Id: |
133 +xxx $ |
163 +xxx $ |
134 % rollback |
164 % rollback |
135 rolling back last transaction |
165 rolling back last transaction |
136 % status |
166 % status |
147 demo.txt = |
177 demo.txt = |
148 [keywordmaps] |
178 [keywordmaps] |
149 Xinfo = {author}: {desc} |
179 Xinfo = {author}: {desc} |
150 $Xinfo: test: hg keyword config and expansion example $ |
180 $Xinfo: test: hg keyword config and expansion example $ |
151 % cat |
181 % cat |
152 expand $Id: a,v 7f0665a496fd 1970/01/01 00:00:00 user $ |
182 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
153 do not process $Id: |
183 do not process $Id: |
154 xxx $ |
184 xxx $ |
155 ignore $Id$ |
185 expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $ |
156 % hg cat |
186 do not process $Id: |
157 expand $Id: a 7f0665a496fd Thu, 01 Jan 1970 00:00:00 +0000 user $ |
187 xxx $ |
158 do not process $Id: |
188 ignore $Id$ |
159 xxx $ |
189 % hg cat |
160 ignore $Id$ |
190 expand $Id: a f782df5f9602 Thu, 01 Jan 1970 00:00:00 +0000 user $ |
|
191 do not process $Id: |
|
192 xxx $ |
|
193 ignore $Id$ |
|
194 a |
161 % interrupted commit |
195 % interrupted commit |
162 transaction abort! |
196 transaction abort! |
163 rollback completed |
197 rollback completed |
|
198 abort: edit failed: false exited with status 1 |
164 % status |
199 % status |
165 M a |
200 M a |
166 ? log |
201 ? log |
167 % commit |
202 % commit |
168 a |
203 a |
169 overwriting a expanding keywords |
204 overwriting a expanding keywords |
170 % status |
205 % status |
171 % cat |
206 % cat |
172 expand $Id: a 576a35651b0a Thu, 01 Jan 1970 00:00:02 +0000 user $ |
207 expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $ |
173 do not process $Id: |
208 do not process $Id: |
174 xxx $ |
209 xxx $ |
175 $Xinfo: User Name <user@example.com>: firstline $ |
210 $Xinfo: User Name <user@example.com>: firstline $ |
176 ignore $Id$ |
211 expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $ |
177 % hg cat |
212 do not process $Id: |
178 expand $Id: a 576a35651b0a Thu, 01 Jan 1970 00:00:02 +0000 user $ |
213 xxx $ |
179 do not process $Id: |
214 $Xinfo: User Name <user@example.com>: firstline $ |
180 xxx $ |
215 ignore $Id$ |
181 $Xinfo: User Name <user@example.com>: firstline $ |
216 % hg cat |
182 ignore $Id$ |
217 expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $ |
|
218 do not process $Id: |
|
219 xxx $ |
|
220 $Xinfo: User Name <user@example.com>: firstline $ |
|
221 ignore $Id$ |
|
222 a |
183 % remove |
223 % remove |
184 % status |
224 % status |
185 % rollback |
225 % rollback |
186 rolling back last transaction |
226 rolling back last transaction |
187 % status |
227 % status |
188 R a |
228 R a |
189 % revert a |
229 % revert a |
190 % cat a |
230 % cat a |
191 expand $Id: a 576a35651b0a Thu, 01 Jan 1970 00:00:02 +0000 user $ |
231 expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $ |
192 do not process $Id: |
232 do not process $Id: |
193 xxx $ |
233 xxx $ |
194 $Xinfo: User Name <user@example.com>: firstline $ |
234 $Xinfo: User Name <user@example.com>: firstline $ |
195 % clone to test incoming |
235 % clone to test incoming |
196 requesting all changes |
236 requesting all changes |
197 adding changesets |
237 adding changesets |
198 adding manifests |
238 adding manifests |
199 adding file changes |
239 adding file changes |
200 added 1 changesets with 2 changes to 2 files |
240 added 1 changesets with 3 changes to 3 files |
201 2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
241 3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
202 % incoming |
242 % incoming |
|
243 comparing with test-keyword/Test-a/../Test |
203 searching for changes |
244 searching for changes |
204 changeset: 1:576a35651b0a |
245 changeset: 1:0729690beff6 |
205 tag: tip |
246 tag: tip |
206 user: User Name <user@example.com> |
247 user: User Name <user@example.com> |
207 date: Thu Jan 01 00:00:02 1970 +0000 |
248 date: Thu Jan 01 00:00:02 1970 +0000 |
208 summary: firstline |
249 summary: firstline |
209 |
250 |
215 abort: outstanding uncommitted changes in given files |
256 abort: outstanding uncommitted changes in given files |
216 x/a |
257 x/a |
217 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e |
258 x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e |
218 overwriting x/a expanding keywords |
259 overwriting x/a expanding keywords |
219 % cat a |
260 % cat a |
220 expand $Id: x/a 2d19a72f00da Thu, 01 Jan 1970 00:00:03 +0000 user $ |
261 expand $Id: x/a f27c134d2d9b Thu, 01 Jan 1970 00:00:03 +0000 user $ |
221 do not process $Id: |
262 do not process $Id: |
222 xxx $ |
263 xxx $ |
223 $Xinfo: User Name <user@example.com>: xa $ |
264 $Xinfo: User Name <user@example.com>: xa $ |
224 % kwshrink a inside directory x |
265 % kwshrink a inside directory x |
225 overwriting x/a shrinking keywords |
266 overwriting x/a shrinking keywords |