#!/bin/sh
cat <<EOF >> $HGRCPATH
[extensions]
hgext.keyword =
[keyword]
a =
b = ignore
EOF
echo % help
hg help keyword
hg init Test
cd Test
echo 'expand $Id$' > a
echo 'ignore $Id$' > b
ln -s a sym
echo % cat
cat sym a b
echo % default keyword expansion
echo % commit
hg --debug commit -A -mabsym -d '0 0' -u 'User Name <user@example.com>'
echo % status
hg status
echo % cat
cat sym a b
echo % hg cat
hg cat sym a b
echo
rm sym a b
echo % update
hg update
echo % cat
cat sym a b
echo % custom keyword expansion
cat <<EOF >>$HGRCPATH
[keywordmaps]
Id = {file} {node|short} {date|rfc822date} {author|user}
Xinfo = {author}: {desc}
EOF
echo % cat
cat sym a b
echo % hg cat
hg cat sym a b
echo
echo '$Xinfo$' >> a
cat <<EOF >> log
firstline
secondline
EOF
echo % commit
hg --debug commit -l log -d '1 0' -u 'User Name <user@example.com>'
rm log
echo % status
hg status
echo % cat
cat sym a b
echo % hg cat
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 sym a b
echo % hg cat
hg cat sym a b
echo
echo % update
rm sym a b
hg update
echo % cat
cat sym a b