author | Christian Ebert <blacktrash@gmx.net> |
Sat, 24 Feb 2007 11:10:31 +0100 | |
branch | kwmap-templates |
changeset 149 | 0c8b7e5c25a6 |
parent 148 | c0baa881d90a |
child 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 |
|
121 | 11 |
Substitution takes place on every commit and update of the working |
12 |
repository. |
|
13 |
||
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
14 |
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
|
15 |
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
|
16 |
safe. |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
17 |
|
121 | 18 |
Configuration is done in the [keyword] and [keywordmaps] sections of |
19 |
hgrc files. |
|
20 |
||
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
21 |
Example: |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
22 |
[keyword] |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
23 |
# filename patterns for expansion are configured in this section |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
24 |
# files matching patterns with value 'ignore' are ignored |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
25 |
**.py = ## expand keywords in all python files |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
26 |
x* = ignore ## but ignore files matching "x*" |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
27 |
... |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
28 |
[keywordmaps] |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
29 |
# custom hg template maps _replace_ the CVS-like default ones |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
30 |
HGdate = {date|rfc822date} |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
31 |
lastlog = {desc} ## same as {desc|firstline} in this context |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
32 |
checked in by = {author} |
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 |
|
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
35 |
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
|
36 |
following defaults: |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
37 |
|
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
38 |
Revision: changeset id |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
39 |
Author: username |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
40 |
Date: %Y/%m/%d %H:%M:%S ## [UTC] |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
41 |
RCSFile: basename,v |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
42 |
Source: /path/to/basename,v |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
43 |
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
|
44 |
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
|
45 |
|
121 | 46 |
no commands defined |
47 |
% cat |
|
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
48 |
expand $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
49 |
expand $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
50 |
ignore $Id$ |
121 | 51 |
% default keyword expansion |
52 |
% commit |
|
53 |
adding a |
|
54 |
adding b |
|
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
55 |
adding sym |
121 | 56 |
a |
57 |
b |
|
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
58 |
sym |
121 | 59 |
overwriting a expanding keywords |
131
23a1e1bdf62b
Check dirstate after commits in test
Christian Ebert <blacktrash@gmx.net>
parents:
129
diff
changeset
|
60 |
% status |
121 | 61 |
% cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
62 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
63 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
64 |
ignore $Id$ |
121 | 65 |
% hg cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
66 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
67 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
68 |
a |
121 | 69 |
% update |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
70 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
121 | 71 |
% cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
72 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
73 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
74 |
ignore $Id$ |
121 | 75 |
% custom keyword expansion |
76 |
% cat |
|
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
77 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
78 |
expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
79 |
ignore $Id$ |
121 | 80 |
% hg cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
81 |
expand $Id: a 126ec311add6 Thu, 01 Jan 1970 00:00:00 +0000 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
82 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
83 |
a |
121 | 84 |
% commit |
85 |
a |
|
86 |
overwriting a expanding keywords |
|
131
23a1e1bdf62b
Check dirstate after commits in test
Christian Ebert <blacktrash@gmx.net>
parents:
129
diff
changeset
|
87 |
% status |
121 | 88 |
% cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
89 |
expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
121 | 90 |
$Xinfo: User Name <user@example.com>: firstline $ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
91 |
expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
92 |
$Xinfo: User Name <user@example.com>: firstline $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
93 |
ignore $Id$ |
121 | 94 |
% hg cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
95 |
expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
121 | 96 |
$Xinfo: User Name <user@example.com>: firstline $ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
97 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
98 |
a |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
99 |
requesting all changes |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
100 |
adding changesets |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
101 |
adding manifests |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
102 |
adding file changes |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
103 |
added 1 changesets with 3 changes to 3 files |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
104 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
105 |
% incoming |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
106 |
searching for changes |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
107 |
changeset: 1:6022c13396d3 |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
108 |
tag: tip |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
109 |
user: User Name <user@example.com> |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
110 |
date: Thu Jan 01 00:00:01 1970 +0000 |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
111 |
summary: firstline |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
112 |
|
121 | 113 |
% switch off expansion |
114 |
% cat |
|
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
115 |
expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
116 |
$Xinfo: User Name <user@example.com>: firstline $ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
117 |
expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $ |
121 | 118 |
$Xinfo: User Name <user@example.com>: firstline $ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
119 |
ignore $Id$ |
121 | 120 |
% hg cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
121 |
expand $Id$ |
121 | 122 |
$Xinfo$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
123 |
ignore $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
124 |
a |
121 | 125 |
% update |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
126 |
3 files updated, 0 files merged, 0 files removed, 0 files unresolved |
121 | 127 |
% cat |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
128 |
expand $Id$ |
121 | 129 |
$Xinfo$ |
148
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
130 |
expand $Id$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
131 |
$Xinfo$ |
c0baa881d90a
Extend test for symlink
Christian Ebert <blacktrash@gmx.net>
parents:
131
diff
changeset
|
132 |
ignore $Id$ |