5816
|
1 |
% help
|
|
2 |
keyword extension - keyword expansion in local repositories
|
|
3 |
|
|
4 |
This extension expands RCS/CVS-like or self-customized $Keywords$
|
|
5 |
in tracked text files selected by your configuration.
|
|
6 |
|
|
7 |
Keywords are only expanded in local repositories and not stored in
|
|
8 |
the change history. The mechanism can be regarded as a convenience
|
|
9 |
for the current user or for archive distribution.
|
|
10 |
|
|
11 |
Configuration is done in the [keyword] and [keywordmaps] sections
|
|
12 |
of hgrc files.
|
|
13 |
|
|
14 |
Example:
|
|
15 |
|
|
16 |
[keyword]
|
|
17 |
# expand keywords in every python file except those matching "x*"
|
|
18 |
**.py =
|
|
19 |
x* = ignore
|
|
20 |
|
|
21 |
Note: the more specific you are in your filename patterns
|
|
22 |
the less you lose speed in huge repos.
|
|
23 |
|
|
24 |
For [keywordmaps] template mapping and expansion demonstration and
|
|
25 |
control run "hg kwdemo".
|
|
26 |
|
|
27 |
An additional date template filter {date|utcdate} is provided.
|
|
28 |
|
|
29 |
The default template mappings (view with "hg kwdemo -d") can be replaced
|
|
30 |
with customized keywords and templates.
|
|
31 |
Again, run "hg kwdemo" to control the results of your config changes.
|
|
32 |
|
|
33 |
Before changing/disabling active keywords, run "hg kwshrink" to avoid
|
|
34 |
the risk of inadvertedly storing expanded keywords in the change history.
|
|
35 |
|
|
36 |
To force expansion after enabling it, or a configuration change, run
|
|
37 |
"hg kwexpand".
|
|
38 |
|
|
39 |
Expansions spanning more than one line and incremental expansions,
|
|
40 |
like CVS' $Log$, are not supported. A keyword template map
|
|
41 |
"Log = {desc}" expands to the first line of the changeset description.
|
|
42 |
|
|
43 |
list of commands:
|
|
44 |
|
|
45 |
kwdemo print [keywordmaps] configuration and an expansion example
|
|
46 |
kwexpand expand keywords in working directory
|
|
47 |
kwfiles print files currently configured for keyword expansion
|
|
48 |
kwshrink revert expanded keywords in working directory
|
|
49 |
|
|
50 |
use "hg -v help keyword" to show aliases and global options
|
|
51 |
% hg kwdemo
|
|
52 |
[extensions]
|
|
53 |
hgext.keyword =
|
|
54 |
[keyword]
|
|
55 |
* =
|
|
56 |
b = ignore
|
|
57 |
demo.txt =
|
|
58 |
[keywordmaps]
|
|
59 |
RCSFile = {file|basename},v
|
|
60 |
Author = {author|user}
|
|
61 |
Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
|
|
62 |
Source = {root}/{file},v
|
|
63 |
Date = {date|utcdate}
|
|
64 |
Id = {file|basename},v {node|short} {date|utcdate} {author|user}
|
|
65 |
Revision = {node|short}
|
|
66 |
$RCSFile: demo.txt,v $
|
|
67 |
$Author: test $
|
|
68 |
$Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
|
|
69 |
$Source: /TMP/demo.txt,v $
|
|
70 |
$Date: 2000/00/00 00:00:00 $
|
|
71 |
$Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
|
|
72 |
$Revision: xxxxxxxxxxxx $
|
|
73 |
[extensions]
|
|
74 |
hgext.keyword =
|
|
75 |
[keyword]
|
|
76 |
* =
|
|
77 |
b = ignore
|
|
78 |
demo.txt =
|
|
79 |
[keywordmaps]
|
|
80 |
Branch = {branches}
|
|
81 |
$Branch: demobranch $
|
|
82 |
% kwshrink should exit silently in empty/invalid repo
|
|
83 |
% cat
|
|
84 |
expand $Id$
|
|
85 |
do not process $Id:
|
|
86 |
xxx $
|
|
87 |
expand $Id$
|
|
88 |
do not process $Id:
|
|
89 |
xxx $
|
|
90 |
ignore $Id$
|
|
91 |
% addremove
|
|
92 |
adding a
|
|
93 |
adding b
|
|
94 |
adding sym
|
|
95 |
% status
|
|
96 |
A a
|
|
97 |
A b
|
|
98 |
A sym
|
|
99 |
% default keyword expansion including commit hook
|
|
100 |
% interrupted commit should not change state or run commit hook
|
|
101 |
a
|
|
102 |
b
|
|
103 |
sym
|
|
104 |
transaction abort!
|
|
105 |
rollback completed
|
|
106 |
abort: edit failed: false exited with status 1
|
|
107 |
% status
|
|
108 |
A a
|
|
109 |
A b
|
|
110 |
A sym
|
|
111 |
% commit
|
|
112 |
a
|
|
113 |
b
|
|
114 |
sym
|
|
115 |
overwriting a expanding keywords
|
|
116 |
running hook commit.test: cp a hooktest
|
|
117 |
% status
|
|
118 |
? hooktest
|
|
119 |
% identify
|
|
120 |
f782df5f9602
|
|
121 |
% cat
|
|
122 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
123 |
do not process $Id:
|
|
124 |
xxx $
|
|
125 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
126 |
do not process $Id:
|
|
127 |
xxx $
|
|
128 |
ignore $Id$
|
|
129 |
% hg cat
|
|
130 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
131 |
do not process $Id:
|
|
132 |
xxx $
|
|
133 |
ignore $Id$
|
|
134 |
a
|
|
135 |
% diff a hooktest
|
|
136 |
% removing commit hook from config
|
|
137 |
% touch
|
|
138 |
% status
|
|
139 |
% update
|
|
140 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
141 |
% cat
|
|
142 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
143 |
do not process $Id:
|
|
144 |
xxx $
|
|
145 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
146 |
do not process $Id:
|
|
147 |
xxx $
|
|
148 |
ignore $Id$
|
|
149 |
% copy
|
|
150 |
% kwfiles added
|
|
151 |
a
|
|
152 |
c
|
|
153 |
% commit
|
|
154 |
c
|
|
155 |
c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
|
|
156 |
overwriting c expanding keywords
|
|
157 |
% cat a c
|
|
158 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
159 |
do not process $Id:
|
|
160 |
xxx $
|
|
161 |
expand $Id: c,v 0ba462c0f077 1970/01/01 00:00:01 user $
|
|
162 |
do not process $Id:
|
|
163 |
xxx $
|
|
164 |
% touch copied c after 1 second
|
|
165 |
% status
|
|
166 |
% kwfiles
|
|
167 |
a
|
|
168 |
c
|
|
169 |
% diff --rev
|
|
170 |
diff -r f782df5f9602 c
|
|
171 |
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
|
|
172 |
@@ -0,0 +1,3 @@
|
|
173 |
+expand $Id: c,v 0ba462c0f077 1970/01/01 00:00:01 user $
|
|
174 |
+do not process $Id:
|
|
175 |
+xxx $
|
|
176 |
% rollback
|
|
177 |
rolling back last transaction
|
|
178 |
% status
|
|
179 |
A c
|
|
180 |
% update -C
|
|
181 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved
|
|
182 |
% custom keyword expansion
|
|
183 |
% try with kwdemo
|
|
184 |
[extensions]
|
|
185 |
hgext.keyword =
|
|
186 |
[keyword]
|
|
187 |
* =
|
|
188 |
b = ignore
|
|
189 |
demo.txt =
|
|
190 |
[keywordmaps]
|
|
191 |
Xinfo = {author}: {desc}
|
|
192 |
$Xinfo: test: hg keyword config and expansion example $
|
|
193 |
% cat
|
|
194 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
195 |
do not process $Id:
|
|
196 |
xxx $
|
|
197 |
expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
|
|
198 |
do not process $Id:
|
|
199 |
xxx $
|
|
200 |
ignore $Id$
|
|
201 |
% hg cat
|
|
202 |
expand $Id: a f782df5f9602 Thu, 01 Jan 1970 00:00:00 +0000 user $
|
|
203 |
do not process $Id:
|
|
204 |
xxx $
|
|
205 |
ignore $Id$
|
|
206 |
a
|
|
207 |
% interrupted commit should not change state
|
|
208 |
transaction abort!
|
|
209 |
rollback completed
|
|
210 |
abort: edit failed: false exited with status 1
|
|
211 |
% status
|
|
212 |
M a
|
|
213 |
? log
|
|
214 |
% commit
|
|
215 |
a
|
|
216 |
overwriting a expanding keywords
|
|
217 |
% status
|
|
218 |
% cat
|
|
219 |
expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
|
220 |
do not process $Id:
|
|
221 |
xxx $
|
|
222 |
$Xinfo: User Name <user@example.com>: firstline $
|
|
223 |
expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
|
224 |
do not process $Id:
|
|
225 |
xxx $
|
|
226 |
$Xinfo: User Name <user@example.com>: firstline $
|
|
227 |
ignore $Id$
|
|
228 |
% hg cat
|
|
229 |
expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
|
230 |
do not process $Id:
|
|
231 |
xxx $
|
|
232 |
$Xinfo: User Name <user@example.com>: firstline $
|
|
233 |
ignore $Id$
|
|
234 |
a
|
|
235 |
% remove
|
|
236 |
% status
|
|
237 |
% rollback
|
|
238 |
rolling back last transaction
|
|
239 |
% status
|
|
240 |
R a
|
|
241 |
% revert a
|
|
242 |
% cat a
|
|
243 |
expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
|
244 |
do not process $Id:
|
|
245 |
xxx $
|
|
246 |
$Xinfo: User Name <user@example.com>: firstline $
|
|
247 |
% clone to test incoming
|
|
248 |
requesting all changes
|
|
249 |
adding changesets
|
|
250 |
adding manifests
|
|
251 |
adding file changes
|
|
252 |
added 1 changesets with 3 changes to 3 files
|
|
253 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
254 |
% incoming
|
|
255 |
comparing with test-keyword/Test-a/../Test
|
|
256 |
searching for changes
|
|
257 |
changeset: 1:0729690beff6
|
|
258 |
tag: tip
|
|
259 |
user: User Name <user@example.com>
|
|
260 |
date: Thu Jan 01 00:00:02 1970 +0000
|
|
261 |
summary: firstline
|
|
262 |
|
|
263 |
% commit rejecttest
|
|
264 |
a
|
|
265 |
overwriting a expanding keywords
|
|
266 |
% export
|
|
267 |
% import
|
|
268 |
applying ../rejecttest.diff
|
|
269 |
% cat
|
|
270 |
expand $Id: a 82983f13f138 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
|
|
271 |
do not process $Id: rejecttest
|
|
272 |
xxx $
|
|
273 |
$Xinfo: User Name <user@example.com>: rejects? $
|
|
274 |
expand $Id: a 82983f13f138 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
|
|
275 |
do not process $Id: rejecttest
|
|
276 |
xxx $
|
|
277 |
$Xinfo: User Name <user@example.com>: rejects? $
|
|
278 |
ignore $Id$
|
|
279 |
|
|
280 |
% rollback
|
|
281 |
rolling back last transaction
|
|
282 |
% clean update
|
|
283 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
|
|
284 |
% kwexpand/kwshrink on selected files
|
|
285 |
% copy a x/a
|
|
286 |
% kwexpand a
|
|
287 |
overwriting a expanding keywords
|
|
288 |
% kwexpand x/a should abort
|
|
289 |
abort: outstanding uncommitted changes in given files
|
|
290 |
x/a
|
|
291 |
x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
|
|
292 |
overwriting x/a expanding keywords
|
|
293 |
% cat a
|
|
294 |
expand $Id: x/a f27c134d2d9b Thu, 01 Jan 1970 00:00:03 +0000 user $
|
|
295 |
do not process $Id:
|
|
296 |
xxx $
|
|
297 |
$Xinfo: User Name <user@example.com>: xa $
|
|
298 |
% kwshrink a inside directory x
|
|
299 |
overwriting x/a shrinking keywords
|
|
300 |
% cat a
|
|
301 |
expand $Id$
|
|
302 |
do not process $Id:
|
|
303 |
xxx $
|
|
304 |
$Xinfo$
|
|
305 |
% kwexpand nonexistent
|
|
306 |
nonexistent: No such file or directory
|
|
307 |
% switch off expansion
|
|
308 |
% kwshrink with unknown file u
|
|
309 |
overwriting a shrinking keywords
|
|
310 |
overwriting x/a shrinking keywords
|
|
311 |
% cat
|
|
312 |
expand $Id$
|
|
313 |
do not process $Id:
|
|
314 |
xxx $
|
|
315 |
$Xinfo$
|
|
316 |
expand $Id$
|
|
317 |
do not process $Id:
|
|
318 |
xxx $
|
|
319 |
$Xinfo$
|
|
320 |
ignore $Id$
|
|
321 |
% hg cat
|
|
322 |
expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
|
|
323 |
do not process $Id:
|
|
324 |
xxx $
|
|
325 |
$Xinfo: User Name <user@example.com>: firstline $
|
|
326 |
ignore $Id$
|
|
327 |
a
|
|
328 |
% cat
|
|
329 |
expand $Id$
|
|
330 |
do not process $Id:
|
|
331 |
xxx $
|
|
332 |
$Xinfo$
|
|
333 |
expand $Id$
|
|
334 |
do not process $Id:
|
|
335 |
xxx $
|
|
336 |
$Xinfo$
|
|
337 |
ignore $Id$
|
|
338 |
% hg cat
|
|
339 |
expand $Id$
|
|
340 |
do not process $Id:
|
|
341 |
xxx $
|
|
342 |
$Xinfo$
|
|
343 |
ignore $Id$
|
|
344 |
a
|