--- a/tests/test-keyword Sun Feb 18 20:10:37 2007 +0100
+++ b/tests/test-keyword Wed Feb 21 02:27:15 2007 +0100
@@ -4,36 +4,38 @@
[extensions]
hgext.keyword =
[keyword]
-* =
-b* = ignore
+a =
+b = ignore
EOF
echo % help
hg help keyword
-hg init a
-cd a
-echo '$Id$' > a
-echo '$Id$' > b
+hg init Test
+cd Test
+echo 'expand $Id$' > a
+echo 'ignore $Id$' > b
+ln -s a sym
echo % cat
-cat a b
+cat sym a b
echo % default keyword expansion
echo % commit
-hg --debug commit -A -m ab -d '0 0' -u 'User Name <user@example.com>'
+hg --debug commit -A -mabsym -d '0 0' -u 'User Name <user@example.com>'
echo % status
hg status
echo % cat
-cat a b
+cat sym a b
echo % hg cat
-hg cat a b
+hg cat sym a b
-rm a b
+echo
+rm sym a b
echo % update
hg update
echo % cat
-cat a b
+cat sym a b
echo % custom keyword expansion
cat <<EOF >>$HGRCPATH
@@ -43,10 +45,11 @@
EOF
echo % cat
-cat a b
+cat sym a b
echo % hg cat
-hg cat a b
+hg cat sym a b
+echo
echo '$Xinfo$' >> a
cat <<EOF >> log
firstline
@@ -60,21 +63,34 @@
hg status
echo % cat
-cat a b
+cat sym a b
echo % hg cat
-hg cat a b
+hg cat sym a b
+
+echo
+cd ..
+hg clone -r0 Test Test-a
+cd Test-a
+cat <<EOF >> .hg/hgrc
+[paths]
+default = ../Test
+EOF
+echo % incoming
+hg incoming
echo % switch off expansion
rm $HGRCPATH
+cd ../Test
echo % cat
-cat a b
+cat sym a b
echo % hg cat
-hg cat a b
+hg cat sym a b
+echo
echo % update
-rm a b
+rm sym a b
hg update
echo % cat
-cat a b
+cat sym a b
--- a/tests/test-keyword.out Sun Feb 18 20:10:37 2007 +0100
+++ b/tests/test-keyword.out Wed Feb 21 02:27:15 2007 +0100
@@ -11,63 +11,122 @@
Substitution takes place on every commit and update of the working
repository.
+Caveat: "hg import" might fail if the patches were exported from a
+repo with a different/no keyword setup, whereas "hg unbundle" is
+safe.
+
Configuration is done in the [keyword] and [keywordmaps] sections of
hgrc files.
+Example:
+ [keyword]
+ # filename patterns for expansion are configured in this section
+ # files matching patterns with value 'ignore' are ignored
+ **.py = ## expand keywords in all python files
+ x* = ignore ## but ignore files matching "x*"
+ ...
+ [keywordmaps]
+ # custom hg template maps _replace_ the CVS-like default ones
+ HGdate = {date|rfc822date}
+ lastlog = {desc} ## same as {desc|firstline} in this context
+ checked in by = {author}
+ ...
+
+If no [keywordmaps] are configured the extension falls back on the
+following defaults:
+
+ Revision: changeset id
+ Author: username
+ Date: %Y/%m/%d %H:%M:%S ## [UTC]
+ RCSFile: basename,v
+ Source: /path/to/basename,v
+ Id: basename,v csetid %Y/%m/%d %H:%M:%S username
+ Header: /path/to/basename,v csetid %Y/%m/%d %H:%M:%S username
+
no commands defined
% cat
-$Id$
-$Id$
+expand $Id$
+expand $Id$
+ignore $Id$
% default keyword expansion
% commit
adding a
adding b
+adding sym
a
b
+sym
overwriting a expanding keywords
% status
% cat
-$Id: a,v b803250b3164 1970/01/01 00:00:00 user $
-$Id$
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+ignore $Id$
% hg cat
-$Id: a,v b803250b3164 1970/01/01 00:00:00 user $
-$Id$
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+ignore $Id$
+a
% update
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cat
-$Id: a,v b803250b3164 1970/01/01 00:00:00 user $
-$Id$
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+ignore $Id$
% custom keyword expansion
% cat
-$Id: a,v b803250b3164 1970/01/01 00:00:00 user $
-$Id$
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+expand $Id: a,v 126ec311add6 1970/01/01 00:00:00 user $
+ignore $Id$
% hg cat
-$Id: a b803250b3164 Thu, 01 Jan 1970 00:00:00 +0000 user $
-$Id$
+expand $Id: a 126ec311add6 Thu, 01 Jan 1970 00:00:00 +0000 user $
+ignore $Id$
+a
% commit
a
overwriting a expanding keywords
% status
% cat
-$Id: a 375046bad9d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
+expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
$Xinfo: User Name <user@example.com>: firstline $
-$Id$
+expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
+$Xinfo: User Name <user@example.com>: firstline $
+ignore $Id$
% hg cat
-$Id: a 375046bad9d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
+expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
$Xinfo: User Name <user@example.com>: firstline $
-$Id$
+ignore $Id$
+a
+requesting all changes
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 3 changes to 3 files
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% incoming
+searching for changes
+changeset: 1:6022c13396d3
+tag: tip
+user: User Name <user@example.com>
+date: Thu Jan 01 00:00:01 1970 +0000
+summary: firstline
+
% switch off expansion
% cat
-$Id: a 375046bad9d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
+expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
+$Xinfo: User Name <user@example.com>: firstline $
+expand $Id: a 6022c13396d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
$Xinfo: User Name <user@example.com>: firstline $
-$Id$
+ignore $Id$
% hg cat
-$Id$
+expand $Id$
$Xinfo$
-$Id$
+ignore $Id$
+a
% update
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+3 files updated, 0 files merged, 0 files removed, 0 files unresolved
% cat
-$Id$
+expand $Id$
$Xinfo$
-$Id$
+expand $Id$
+$Xinfo$
+ignore $Id$