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