author | Christian Ebert <blacktrash@gmx.net> |
Sat, 24 Feb 2007 11:56:08 +0100 | |
branch | kwmap-templates |
changeset 151 | 5f3856a6ce56 |
parent 148 | c0baa881d90a |
child 152 | 7ca8e7661609 |
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 |
# files matching patterns with value 'ignore' are ignored |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
27 |
**.py = ## expand keywords in all python files |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
28 |
x* = ignore ## but ignore files matching "x*" |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
29 |
** = archive ## keywords in all textfiles are expanded |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
30 |
## when creating a distribution |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
31 |
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
|
32 |
## on archive creation |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
33 |
... |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
34 |
[keywordmaps] |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
35 |
# custom hg template maps _replace_ the CVS-like default ones |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
36 |
HGdate = {date|rfc822date} |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
37 |
lastlog = {desc} ## same as {desc|firstline} in this context |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
38 |
checked in by = {author} |
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 |
|
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
41 |
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
|
42 |
following defaults: |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
43 |
|
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
44 |
Revision: changeset id |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
45 |
Author: username |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
46 |
Date: %Y/%m/%d %H:%M:%S ## [UTC] |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
47 |
RCSFile: basename,v |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
48 |
Source: /path/to/basename,v |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
49 |
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
|
50 |
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
|
51 |
|
121 | 52 |
no commands defined |
53 |
% cat |
|
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
54 |
expand $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
55 |
ignore $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
56 |
archive $Id$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
57 |
expand $Id$ |
121 | 58 |
% default keyword expansion |
59 |
% commit |
|
60 |
adding a |
|
61 |
adding b |
|
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
62 |
adding c |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
63 |
adding sym |
121 | 64 |
a |
65 |
b |
|
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
66 |
c |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
67 |
sym |
121 | 68 |
overwriting a expanding keywords |
131
23a1e1bdf62b
Check dirstate after commits in test
Christian Ebert <blacktrash@gmx.net>
parents:
129
diff
changeset
|
69 |
% status |
121 | 70 |
% cat |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
71 |
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
|
72 |
ignore $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
73 |
archive $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
74 |
expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
121 | 75 |
% hg cat |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
76 |
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
|
77 |
archive $Id$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
78 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
79 |
a |
121 | 80 |
% update |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
81 |
4 files updated, 0 files merged, 0 files removed, 0 files unresolved |
121 | 82 |
% cat |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
83 |
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
|
84 |
ignore $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
85 |
archive $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
86 |
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
|
87 |
% archive |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
88 |
% cat |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
89 |
expand $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
90 |
ignore $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
91 |
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
|
92 |
a |
121 | 93 |
% custom keyword expansion |
94 |
% cat |
|
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
95 |
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
|
96 |
ignore $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
97 |
archive $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
98 |
expand $Id: a,v 99e97605039e 1970/01/01 00:00:00 user $ |
121 | 99 |
% hg cat |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
100 |
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
|
101 |
archive $Id$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
102 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
103 |
a |
121 | 104 |
% commit |
105 |
a |
|
106 |
overwriting a expanding keywords |
|
131
23a1e1bdf62b
Check dirstate after commits in test
Christian Ebert <blacktrash@gmx.net>
parents:
129
diff
changeset
|
107 |
% status |
121 | 108 |
% cat |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
109 |
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
|
110 |
$Xinfo: User Name <user@example.com>: firstline $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
111 |
ignore $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
112 |
archive $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
113 |
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
|
114 |
$Xinfo: User Name <user@example.com>: firstline $ |
121 | 115 |
% hg cat |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
116 |
expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
121 | 117 |
$Xinfo: User Name <user@example.com>: firstline $ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
118 |
archive $Id$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
119 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
120 |
a |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
121 |
requesting all changes |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
122 |
adding changesets |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
123 |
adding manifests |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
124 |
adding file changes |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
125 |
added 1 changesets with 4 changes to 4 files |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
126 |
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
|
127 |
% incoming |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
128 |
searching for changes |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
129 |
changeset: 1:001dbcdc5258 |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
130 |
tag: tip |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
131 |
user: User Name <user@example.com> |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
132 |
date: Thu Jan 01 00:00:01 1970 +0000 |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
133 |
summary: firstline |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
134 |
|
121 | 135 |
% switch off expansion |
136 |
% cat |
|
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
137 |
expand $Id: a 001dbcdc5258 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
121 | 138 |
$Xinfo: User Name <user@example.com>: firstline $ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
139 |
ignore $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
140 |
archive $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
141 |
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
|
142 |
$Xinfo: User Name <user@example.com>: firstline $ |
121 | 143 |
% hg cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
144 |
expand $Id$ |
121 | 145 |
$Xinfo$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
146 |
archive $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
147 |
ignore $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
148 |
a |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
149 |
% update |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
150 |
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
|
151 |
% cat |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
152 |
expand $Id$ |
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
153 |
$Xinfo$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
154 |
ignore $Id$ |
151
5f3856a6ce56
Extend test for archive mode
Christian Ebert <blacktrash@gmx.net>
parents:
148
diff
changeset
|
155 |
archive $Id$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
156 |
expand $Id$ |
121 | 157 |
$Xinfo$ |