tests: unify test-keyword
authorChristian Ebert <blacktrash@gmx.net>
Fri, 13 Aug 2010 13:54:33 +0100
changeset 11904 122e3e0ba3e4
parent 11903 a4cc9e6f41c3
child 11905 0b84864d1325
tests: unify test-keyword
tests/test-keyword
tests/test-keyword.out
tests/test-keyword.t
--- a/tests/test-keyword	Fri Aug 13 13:20:15 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,418 +0,0 @@
-#!/bin/sh
-
-cat <<EOF >> $HGRCPATH
-[extensions]
-keyword =
-mq =
-notify =
-record =
-transplant =
-[ui]
-interactive = true
-EOF
-
-# demo before [keyword] files are set up
-# would succeed without uisetup otherwise
-echo % hg kwdemo
-hg --quiet kwdemo \
-| sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
- -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
- -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
- -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
-
-hg --quiet kwdemo "Branch = {branches}"
-
-cat <<EOF >> $HGRCPATH
-[keyword]
-** =
-b = ignore
-[hooks]
-commit=
-commit.test=cp a hooktest
-EOF
-
-hg init Test-bndl
-cd Test-bndl
-
-echo % kwshrink should exit silently in empty/invalid repo
-hg kwshrink
-
-# Symlinks cannot be created on Windows. The bundle was made with:
-#
-# hg init t
-# cd t
-# echo a > a
-# ln -s a sym
-# hg add sym
-# hg ci -m addsym -u mercurial
-# hg bundle --base null ../test-keyword.hg
-#
-hg pull -u "$TESTDIR/test-keyword.hg" \
-    | sed 's/pulling from.*test-keyword.hg/pulling from test-keyword.hg/'
-
-echo 'expand $Id$' > a
-echo 'do not process $Id:' >> a
-echo 'xxx $' >> a
-echo 'ignore $Id$' > b
-echo % cat
-cat a b
-
-echo % no kwfiles
-hg kwfiles
-echo % untracked candidates
-hg -v kwfiles --unknown
-
-echo % addremove
-hg addremove
-echo % status
-hg status
-
-echo % default keyword expansion including commit hook
-echo % interrupted commit should not change state or run commit hook
-hg --debug commit
-echo % status
-hg status
-
-echo % commit
-hg --debug commit -mabsym -u 'User Name <user@example.com>'
-echo % status
-hg status
-echo % identify
-hg debugrebuildstate
-hg --quiet identify
-echo % cat
-cat a b
-echo % hg cat
-hg cat sym a b
-
-echo
-echo % diff a hooktest
-diff a hooktest
-
-echo % removing commit hook from config
-sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
-mv "$HGRCPATH".nohook "$HGRCPATH"
-rm hooktest
-
-echo % bundle
-hg bundle --base null ../kw.hg
-
-cd ..
-hg init Test
-cd Test
-
-echo % notify on pull to check whether keywords stay as is in email
-echo % ie. if patch.diff wrapper acts as it should
-
-cat <<EOF >> $HGRCPATH
-[hooks]
-incoming.notify = python:hgext.notify.hook
-[notify]
-sources = pull
-diffstat = False
-[reposubs]
-* = Test
-EOF
-
-echo % pull from bundle
-hg pull -u ../kw.hg 2>&1 | sed -e '/^Content-Type:/,/^diffs (/ d'
-
-echo % remove notify config
-sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify
-mv "$HGRCPATH".nonotify "$HGRCPATH"
-
-echo % touch
-touch a b
-echo % status
-hg status
-
-rm sym a b
-echo % update
-hg update -C
-echo % cat
-cat a b
-
-echo % check whether expansion is filewise
-echo '$Id$' > c
-echo 'tests for different changenodes' >> c
-echo % commit c
-hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
-echo % force expansion
-hg -v kwexpand
-echo % compare changenodes in a c
-cat a c
-
-echo % record chunk
-python -c \
-'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
-hg record -d '1 10' -m rectest<<EOF
-y
-y
-n
-EOF
-echo
-hg identify
-hg status
-echo % cat modified file
-cat a
-hg diff | grep -v 'b/a'
-hg rollback
-
-echo % record file
-echo foo > msg
-# do not use "hg record -m" here!
-hg record -l msg -d '1 11'<<EOF
-y
-y
-y
-EOF
-echo % a should be clean
-hg status -A a
-rm msg
-hg rollback
-hg update -C
-
-echo % init --mq
-hg init --mq
-echo % qimport
-hg qimport -r tip -n mqtest.diff
-echo % commit --mq
-hg commit --mq -m mqtest
-echo % keywords should not be expanded in patch
-cat .hg/patches/mqtest.diff
-echo % qpop
-hg qpop
-echo % qgoto - should imply qpush
-hg qgoto mqtest.diff
-echo % cat
-cat c
-echo % hg cat
-hg cat c
-echo % keyword should not be expanded in filelog
-hg --config 'extensions.keyword=!' cat c
-echo % qpop and move on
-hg qpop
-
-echo % copy
-hg cp a c
-
-echo % kwfiles added
-hg kwfiles
-
-echo % commit
-hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
-echo % cat a c
-cat a c
-echo % touch copied c
-touch c
-echo % status
-hg status
-
-echo % kwfiles
-hg kwfiles
-echo % ignored files
-hg -v kwfiles --ignore
-echo % all files
-hg kwfiles --all
-
-echo % diff --rev
-hg diff --rev 1 | grep -v 'b/c'
-
-echo % rollback
-hg rollback
-echo % status
-hg status
-echo % update -C
-hg update --clean
-
-echo % custom keyword expansion
-echo % try with kwdemo
-hg --quiet kwdemo "Xinfo = {author}: {desc}"
-
-cat <<EOF >>$HGRCPATH
-[keywordmaps]
-Id = {file} {node|short} {date|rfc822date} {author|user}
-Xinfo = {author}: {desc}
-EOF
-
-echo % cat
-cat a b
-echo % hg cat
-hg cat sym a b
-
-echo
-echo '$Xinfo$' >> a
-cat <<EOF >> log
-firstline
-secondline
-EOF
-
-echo % interrupted commit should not change state
-hg commit
-echo % status
-hg status
-
-echo % commit
-hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
-rm log
-echo % status
-hg status
-echo % verify
-hg verify
-
-echo % cat
-cat a b
-echo % hg cat
-hg cat sym a b
-echo
-echo % annotate
-hg annotate a
-
-echo % remove
-hg debugrebuildstate
-hg remove a
-hg --debug commit -m rma
-echo % status
-hg status
-echo % rollback
-hg rollback
-echo % status
-hg status
-echo % revert a
-hg revert --no-backup --rev tip a
-echo % cat a
-cat a
-
-echo % clone
-cd ..
-
-echo % expansion in dest
-hg --quiet clone Test globalconf
-cat globalconf/a
-echo % no expansion in dest
-hg --quiet --config 'keyword.**=ignore' clone Test localconf
-cat localconf/a
-
-echo % clone to test incoming
-hg clone -r1 Test Test-a
-cd Test-a
-cat <<EOF >> .hg/hgrc
-[paths]
-default = ../Test
-EOF
-echo % incoming
-# remove path to temp dir
-hg incoming | sed -e 's/^\(comparing with \).*\(test-keyword.*\)/\1\2/'
-
-sed -e 's/Id.*/& rejecttest/' a > a.new
-mv a.new a
-echo % commit rejecttest
-hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
-echo % export
-hg export -o ../rejecttest.diff tip
-
-cd ../Test
-echo % import
-hg import ../rejecttest.diff
-echo % cat
-cat a b
-echo
-echo % rollback
-hg rollback
-echo % clean update
-hg update --clean
-
-echo % kwexpand/kwshrink on selected files
-mkdir x
-echo % copy a x/a
-hg copy a x/a
-echo % kwexpand a
-hg --verbose kwexpand a
-echo % kwexpand x/a should abort
-hg --verbose kwexpand x/a
-cd x
-hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
-echo % cat a
-cat a
-echo % kwshrink a inside directory x
-hg --verbose kwshrink a
-echo % cat a
-cat a
-cd ..
-
-echo % kwexpand nonexistent
-hg kwexpand nonexistent 2>&1 | sed 's/nonexistent:.*/nonexistent:/'
-
-echo % hg serve
-hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
-cat hg.pid >> $DAEMON_PIDS
-echo % expansion
-echo % hgweb file
-("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/file/tip/a/?style=raw')
-echo % no expansion
-echo % hgweb annotate
-("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/annotate/tip/a/?style=raw')
-echo % hgweb changeset
-("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/rev/tip/?style=raw')
-echo % hgweb filediff
-("$TESTDIR/get-with-headers.py" localhost:$HGPORT '/diff/bb948857c743/a?style=raw')
-echo % errors encountered
-cat errors.log
-
-echo % merge/resolve
-echo '$Id$' > m
-hg add m
-hg commit -m 4kw 
-echo foo >> m
-hg commit -m 5foo
-echo % simplemerge
-hg update 4
-echo foo >> m
-hg commit -m 6foo
-hg merge
-hg commit -m simplemerge
-cat m
-echo % conflict
-hg update 4
-echo bar >> m
-hg commit -m 8bar
-hg merge
-echo % keyword stays outside conflict zone
-cat m
-echo % resolve to local
-HGMERGE=internal:local hg resolve -a
-hg commit -m localresolve
-cat m
-
-echo % test restricted mode with transplant -b
-hg update 6
-hg branch foo
-mv a a.bak
-echo foobranch > a
-cat a.bak >> a
-rm a.bak
-hg commit -m 9foobranch
-hg update default
-hg -y transplant -b foo tip
-echo % no expansion in changeset
-hg tip -p
-echo % expansion in file
-head -n 2 a
-hg -q rollback
-hg -q update -C
-
-echo % switch off expansion
-echo % kwshrink with unknown file u
-cp a u
-hg --verbose kwshrink
-echo % cat
-cat a b
-echo % hg cat
-hg cat sym a b
-echo
-rm "$HGRCPATH"
-echo % cat
-cat a b
-echo % hg cat
-hg cat sym a b
-echo
--- a/tests/test-keyword.out	Fri Aug 13 13:20:15 2010 -0500
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,547 +0,0 @@
-% hg kwdemo
-[extensions]
-keyword =
-[keyword]
-demo.txt = 
-[keywordmaps]
-Author = {author|user}
-Date = {date|utcdate}
-Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
-Id = {file|basename},v {node|short} {date|utcdate} {author|user}
-RCSFile = {file|basename},v
-RCSfile = {file|basename},v
-Revision = {node|short}
-Source = {root}/{file},v
-$Author: test $
-$Date: 2000/00/00 00:00:00 $
-$Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
-$Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
-$RCSFile: demo.txt,v $
-$RCSfile: demo.txt,v $
-$Revision: xxxxxxxxxxxx $
-$Source: /TMP/demo.txt,v $
-[extensions]
-keyword =
-[keyword]
-demo.txt = 
-[keywordmaps]
-Branch = {branches}
-$Branch: demobranch $
-% kwshrink should exit silently in empty/invalid repo
-pulling from test-keyword.hg
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 1 changesets with 1 changes to 1 files
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% cat
-expand $Id$
-do not process $Id:
-xxx $
-ignore $Id$
-% no kwfiles
-% untracked candidates
-k a
-% addremove
-adding a
-adding b
-% status
-A a
-A b
-% default keyword expansion including commit hook
-% interrupted commit should not change state or run commit hook
-abort: empty commit message
-% status
-A a
-A b
-% commit
-a
-b
-overwriting a expanding keywords
-running hook commit.test: cp a hooktest
-committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
-% status
-? hooktest
-% identify
-ef63ca68695b
-% cat
-expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
-do not process $Id:
-xxx $
-ignore $Id$
-% hg cat
-expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
-do not process $Id:
-xxx $
-ignore $Id$
-a
-% diff a hooktest
-% removing commit hook from config
-% bundle
-2 changesets found
-% notify on pull to check whether keywords stay as is in email
-% ie. if patch.diff wrapper acts as it should
-% pull from bundle
-pulling from ../kw.hg
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 3 changes to 3 files
-
-diff -r 000000000000 -r a2392c293916 sym
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/sym	Sat Feb 09 20:25:47 2008 +0100
-@@ -0,0 +1,1 @@
-+a
-\ No newline at end of file
-
-diff -r a2392c293916 -r ef63ca68695b a
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/a	Thu Jan 01 00:00:00 1970 +0000
-@@ -0,0 +1,3 @@
-+expand $Id$
-+do not process $Id:
-+xxx $
-diff -r a2392c293916 -r ef63ca68695b b
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/b	Thu Jan 01 00:00:00 1970 +0000
-@@ -0,0 +1,1 @@
-+ignore $Id$
-3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% remove notify config
-% touch
-% status
-% update
-3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% cat
-expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
-do not process $Id:
-xxx $
-ignore $Id$
-% check whether expansion is filewise
-% commit c
-adding c
-% force expansion
-overwriting a expanding keywords
-overwriting c expanding keywords
-% compare changenodes in a c
-expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
-do not process $Id:
-xxx $
-$Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
-tests for different changenodes
-% record chunk
-diff --git a/a b/a
-2 hunks, 2 lines changed
-examine changes to 'a'? [Ynsfdaq?] 
-@@ -1,3 +1,4 @@
- expand $Id$
-+foo
- do not process $Id:
- xxx $
-record change 1/2 to 'a'? [Ynsfdaq?] 
-@@ -2,2 +3,3 @@
- do not process $Id:
- xxx $
-+bar
-record change 2/2 to 'a'? [Ynsfdaq?] 
-
-d17e03c92c97+ tip
-M a
-% cat modified file
-expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
-foo
-do not process $Id:
-xxx $
-bar
-diff -r d17e03c92c97 a
---- a/a	Wed Dec 31 23:59:51 1969 -0000
-@@ -2,3 +2,4 @@
- foo
- do not process $Id:
- xxx $
-+bar
-rolling back to revision 2 (undo commit)
-% record file
-diff --git a/a b/a
-2 hunks, 2 lines changed
-examine changes to 'a'? [Ynsfdaq?] 
-@@ -1,3 +1,4 @@
- expand $Id$
-+foo
- do not process $Id:
- xxx $
-record change 1/2 to 'a'? [Ynsfdaq?] 
-@@ -2,2 +3,3 @@
- do not process $Id:
- xxx $
-+bar
-record change 2/2 to 'a'? [Ynsfdaq?] 
-% a should be clean
-C a
-rolling back to revision 2 (undo commit)
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% init --mq
-% qimport
-% commit --mq
-% keywords should not be expanded in patch
-# HG changeset patch
-# User User Name <user@example.com>
-# Date 1 0
-# Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
-# Parent  ef63ca68695bc9495032c6fda1350c71e6d256e9
-cndiff
-
-diff -r ef63ca68695b -r 40a904bbbe4c c
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/c	Thu Jan 01 00:00:01 1970 +0000
-@@ -0,0 +1,2 @@
-+$Id$
-+tests for different changenodes
-% qpop
-popping mqtest.diff
-patch queue now empty
-% qgoto - should imply qpush
-applying mqtest.diff
-now at: mqtest.diff
-% cat
-$Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
-tests for different changenodes
-% hg cat
-$Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
-tests for different changenodes
-% keyword should not be expanded in filelog
-$Id$
-tests for different changenodes
-% qpop and move on
-popping mqtest.diff
-patch queue now empty
-% copy
-% kwfiles added
-a
-c
-% commit
-c
- c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
-overwriting c expanding keywords
-committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
-% cat a c
-expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
-do not process $Id:
-xxx $
-expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
-do not process $Id:
-xxx $
-% touch copied c
-% status
-% kwfiles
-a
-c
-% ignored files
-I b
-I sym
-% all files
-K a
-K c
-I b
-I sym
-% diff --rev
-diff -r ef63ca68695b c
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-@@ -0,0 +1,3 @@
-+expand $Id$
-+do not process $Id:
-+xxx $
-% rollback
-rolling back to revision 1 (undo commit)
-% status
-A c
-% update -C
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% custom keyword expansion
-% try with kwdemo
-[extensions]
-keyword =
-[keyword]
-** = 
-b = ignore
-demo.txt = 
-[keywordmaps]
-Xinfo = {author}: {desc}
-$Xinfo: test: hg keyword configuration and expansion example $
-% cat
-expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
-do not process $Id:
-xxx $
-ignore $Id$
-% hg cat
-expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
-do not process $Id:
-xxx $
-ignore $Id$
-a
-% interrupted commit should not change state
-abort: empty commit message
-% status
-M a
-? c
-? log
-% commit
-a
-overwriting a expanding keywords
-committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
-% status
-? c
-% verify
-checking changesets
-checking manifests
-crosschecking files in changesets and manifests
-checking files
-3 files, 3 changesets, 4 total revisions
-% cat
-expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: firstline $
-ignore $Id$
-% hg cat
-expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: firstline $
-ignore $Id$
-a
-% annotate
-1: expand $Id$
-1: do not process $Id:
-1: xxx $
-2: $Xinfo$
-% remove
-committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
-% status
-? c
-% rollback
-rolling back to revision 2 (undo commit)
-% status
-R a
-? c
-% revert a
-% cat a
-expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: firstline $
-% clone
-% expansion in dest
-expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: firstline $
-% no expansion in dest
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-% clone to test incoming
-requesting all changes
-adding changesets
-adding manifests
-adding file changes
-added 2 changesets with 3 changes to 3 files
-updating to branch default
-3 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% incoming
-comparing with test-keyword/Test
-searching for changes
-changeset:   2:bb948857c743
-tag:         tip
-user:        User Name <user@example.com>
-date:        Thu Jan 01 00:00:02 1970 +0000
-summary:     firstline
-
-% commit rejecttest
-a
-overwriting a expanding keywords
-committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
-% export
-% import
-applying ../rejecttest.diff
-% cat
-expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
-do not process $Id: rejecttest
-xxx $
-$Xinfo: User Name <user@example.com>: rejects? $
-ignore $Id$
-
-% rollback
-rolling back to revision 2 (undo commit)
-% clean update
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-% kwexpand/kwshrink on selected files
-% copy a x/a
-% kwexpand a
-overwriting a expanding keywords
-% kwexpand x/a should abort
-abort: outstanding uncommitted changes
-x/a
- x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
-overwriting x/a expanding keywords
-committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
-% cat a
-expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: xa $
-% kwshrink a inside directory x
-overwriting x/a shrinking keywords
-% cat a
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-% kwexpand nonexistent
-nonexistent:
-% hg serve
-% expansion
-% hgweb file
-200 Script output follows
-
-expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: firstline $
-% no expansion
-% hgweb annotate
-200 Script output follows
-
-
-user@1: expand $Id$
-user@1: do not process $Id:
-user@1: xxx $
-user@2: $Xinfo$
-
-
-
-
-% hgweb changeset
-200 Script output follows
-
-
-# HG changeset patch
-# User User Name <user@example.com>
-# Date 3 0
-# Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
-# Parent  bb948857c743469b22bbf51f7ec8112279ca5d83
-xa
-
-diff -r bb948857c743 -r b4560182a3f9 x/a
---- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/x/a	Thu Jan 01 00:00:03 1970 +0000
-@@ -0,0 +1,4 @@
-+expand $Id$
-+do not process $Id:
-+xxx $
-+$Xinfo$
-
-% hgweb filediff
-200 Script output follows
-
-
-diff -r ef63ca68695b -r bb948857c743 a
---- a/a	Thu Jan 01 00:00:00 1970 +0000
-+++ b/a	Thu Jan 01 00:00:02 1970 +0000
-@@ -1,3 +1,4 @@
- expand $Id$
- do not process $Id:
- xxx $
-+$Xinfo$
-
-
-
-
-% errors encountered
-% merge/resolve
-% simplemerge
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-0 files updated, 0 files merged, 0 files removed, 0 files unresolved
-(branch merge, don't forget to commit)
-$Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
-foo
-% conflict
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-created new head
-merging m
-warning: conflicts during merge.
-merging m failed!
-0 files updated, 0 files merged, 0 files removed, 1 files unresolved
-use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
-% keyword stays outside conflict zone
-$Id$
-<<<<<<< local
-bar
-=======
-foo
->>>>>>> other
-% resolve to local
-$Id: m 41efa6d38e9b Thu, 01 Jan 1970 00:00:00 +0000 test $
-bar
-% test restricted mode with transplant -b
-1 files updated, 0 files merged, 0 files removed, 0 files unresolved
-marked working directory as branch foo
-2 files updated, 0 files merged, 0 files removed, 0 files unresolved
-applying 4aa30d025d50
-4aa30d025d50 transplanted to 5a4da427c162
-% no expansion in changeset
-changeset:   11:5a4da427c162
-tag:         tip
-parent:      9:41efa6d38e9b
-user:        test
-date:        Thu Jan 01 00:00:00 1970 +0000
-summary:     9foobranch
-
-diff -r 41efa6d38e9b -r 5a4da427c162 a
---- a/a	Thu Jan 01 00:00:00 1970 +0000
-+++ b/a	Thu Jan 01 00:00:00 1970 +0000
-@@ -1,3 +1,4 @@
-+foobranch
- expand $Id$
- do not process $Id:
- xxx $
-
-% expansion in file
-foobranch
-expand $Id: a 5a4da427c162 Thu, 01 Jan 1970 00:00:00 +0000 test $
-% switch off expansion
-% kwshrink with unknown file u
-overwriting a shrinking keywords
-overwriting m shrinking keywords
-overwriting x/a shrinking keywords
-% cat
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-ignore $Id$
-% hg cat
-expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
-do not process $Id:
-xxx $
-$Xinfo: User Name <user@example.com>: firstline $
-ignore $Id$
-a
-% cat
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-ignore $Id$
-% hg cat
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-ignore $Id$
-a
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/test-keyword.t	Fri Aug 13 13:54:33 2010 +0100
@@ -0,0 +1,925 @@
+  $ cat <<EOF >> $HGRCPATH
+  > [extensions]
+  > keyword =
+  > mq =
+  > notify =
+  > record =
+  > transplant =
+  > [ui]
+  > interactive = true
+  > EOF
+
+Run kwdemo before [keyword] files are set up
+as it would succeed without uisetup otherwise
+
+  $ hg --quiet kwdemo \
+  > | sed -e 's![^ ][^ ]*demo.txt,v!/TMP/demo.txt,v!' \
+  >  -e 's/,v [a-z0-9][a-z0-9]* /,v xxxxxxxxxxxx /' \
+  >  -e '/[$]Revision/ s/: [a-z0-9][a-z0-9]* /: xxxxxxxxxxxx /' \
+  >  -e 's! 20[0-9][0-9]/[01][0-9]/[0-3][0-9] [0-2][0-9]:[0-6][0-9]:[0-6][0-9]! 2000/00/00 00:00:00!'
+  [extensions]
+  keyword =
+  [keyword]
+  demo.txt = 
+  [keywordmaps]
+  Author = {author|user}
+  Date = {date|utcdate}
+  Header = {root}/{file},v {node|short} {date|utcdate} {author|user}
+  Id = {file|basename},v {node|short} {date|utcdate} {author|user}
+  RCSFile = {file|basename},v
+  RCSfile = {file|basename},v
+  Revision = {node|short}
+  Source = {root}/{file},v
+  $Author: test $
+  $Date: 2000/00/00 00:00:00 $
+  $Header: /TMP/demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
+  $Id: demo.txt,v xxxxxxxxxxxx 2000/00/00 00:00:00 test $
+  $RCSFile: demo.txt,v $
+  $RCSfile: demo.txt,v $
+  $Revision: xxxxxxxxxxxx $
+  $Source: /TMP/demo.txt,v $
+
+  $ hg --quiet kwdemo "Branch = {branches}"
+  [extensions]
+  keyword =
+  [keyword]
+  demo.txt = 
+  [keywordmaps]
+  Branch = {branches}
+  $Branch: demobranch $
+
+  $ cat <<EOF >> $HGRCPATH
+  > [keyword]
+  > ** =
+  > b = ignore
+  > [hooks]
+  > commit=
+  > commit.test=cp a hooktest
+  > EOF
+
+  $ hg init Test-bndl
+  $ cd Test-bndl
+
+kwshrink should exit silently in empty/invalid repo
+
+  $ hg kwshrink
+
+Symlinks cannot be created on Windows.
+A bundle to test this was made with:
+ hg init t
+ cd t
+ echo a > a
+ ln -s a sym
+ hg add sym
+ hg ci -m addsym -u mercurial
+ hg bundle --base null ../test-keyword.hg
+
+  $ hg pull -u "$TESTDIR"/test-keyword.hg
+  pulling from .*test-keyword.hg
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 1 changesets with 1 changes to 1 files
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+  $ echo 'expand $Id$' > a
+  $ echo 'do not process $Id:' >> a
+  $ echo 'xxx $' >> a
+  $ echo 'ignore $Id$' > b
+
+Output files as they were created
+
+  $ cat a b
+  expand $Id$
+  do not process $Id:
+  xxx $
+  ignore $Id$
+
+no kwfiles
+
+  $ hg kwfiles
+
+untracked candidates
+
+  $ hg -v kwfiles --unknown
+  k a
+
+Add files and check status
+
+  $ hg addremove
+  adding a
+  adding b
+  $ hg status
+  A a
+  A b
+
+
+Default keyword expansion including commit hook
+Interrupted commit should not change state or run commit hook
+
+  $ hg --debug commit
+  abort: empty commit message
+  $ hg status
+  A a
+  A b
+
+Commit with several checks
+
+  $ hg --debug commit -mabsym -u 'User Name <user@example.com>'
+  a
+  b
+  overwriting a expanding keywords
+  running hook commit.test: cp a hooktest
+  committed changeset 1:ef63ca68695bc9495032c6fda1350c71e6d256e9
+  $ hg status
+  ? hooktest
+  $ hg debugrebuildstate
+  $ hg --quiet identify
+  ef63ca68695b
+
+cat files in working directory with keywords expanded
+
+  $ cat a b
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  do not process $Id:
+  xxx $
+  ignore $Id$
+
+hg cat files and symlink, no expansion
+
+  $ hg cat sym a b && echo
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  do not process $Id:
+  xxx $
+  ignore $Id$
+  a.*
+
+Test hook execution
+
+  $ diff a hooktest
+
+Removing commit hook from config
+
+  $ sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
+  $ mv "$HGRCPATH".nohook "$HGRCPATH"
+  $ rm hooktest
+
+bundle
+
+  $ hg bundle --base null ../kw.hg
+  2 changesets found
+  $ cd ..
+  $ hg init Test
+  $ cd Test
+
+Notify on pull to check whether keywords stay as is in email
+ie. if patch.diff wrapper acts as it should
+
+  $ cat <<EOF >> $HGRCPATH
+  > [hooks]
+  > incoming.notify = python:hgext.notify.hook
+  > [notify]
+  > sources = pull
+  > diffstat = False
+  > [reposubs]
+  > * = Test
+  > EOF
+
+Pull from bundle and trigger notify
+
+  $ hg pull -u ../kw.hg
+  pulling from ../kw.hg
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 3 changes to 3 files
+  Content-Type: text/plain; charset="us-ascii"
+  MIME-Version: 1.0
+  Content-Transfer-Encoding: 7bit
+  Date: .*
+  Subject: changeset in .*
+  From: mercurial
+  X-Hg-Notification: changeset a2392c293916
+  Message-Id: <hg.a2392c293916.*>
+  To: Test
+  
+  changeset a2392c293916 in .*
+  details: .*?cmd=changeset;node=a2392c293916
+  description:
+  	addsym
+  
+  diffs (6 lines):
+  
+  diff -r 000000000000 -r a2392c293916 sym
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/sym	Sat Feb 09 20:25:47 2008 +0100
+  @@ -0,0 +1,1 @@
+  +a
+  \ No newline at end of file
+  Content-Type: text/plain; charset="us-ascii"
+  MIME-Version: 1.0
+  Content-Transfer-Encoding: 7bit
+  Date:.*
+  Subject: changeset in.*
+  From: User Name <user@example.com>
+  X-Hg-Notification: changeset ef63ca68695b
+  Message-Id: <hg.ef63ca68695b.*>
+  To: Test
+  
+  changeset ef63ca68695b in .*
+  details: .*?cmd=changeset;node=ef63ca68695b
+  description:
+  	absym
+  
+  diffs (12 lines):
+  
+  diff -r a2392c293916 -r ef63ca68695b a
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,3 @@
+  +expand $Id$
+  +do not process $Id:
+  +xxx $
+  diff -r a2392c293916 -r ef63ca68695b b
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/b	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,1 @@
+  +ignore $Id$
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Remove notify config
+
+  $ sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nonotify
+  $ mv "$HGRCPATH".nonotify "$HGRCPATH"
+
+Touch files and check with status
+
+  $ touch a b
+  $ hg status
+
+Update and expand
+
+  $ rm sym a b
+  $ hg update -C
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cat a b
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  do not process $Id:
+  xxx $
+  ignore $Id$
+
+Check whether expansion is filewise
+
+  $ echo '$Id$' > c
+  $ echo 'tests for different changenodes' >> c
+
+commit file c
+
+  $ hg commit -A -mcndiff -d '1 0' -u 'User Name <user@example.com>'
+  adding c
+
+force expansion
+
+  $ hg -v kwexpand
+  overwriting a expanding keywords
+  overwriting c expanding keywords
+
+compare changenodes in a and c
+
+  $ cat a c
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  do not process $Id:
+  xxx $
+  $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
+  tests for different changenodes
+
+record chunk
+
+  $ python -c \
+  > 'l=open("a").readlines();l.insert(1,"foo\n");l.append("bar\n");open("a","w").writelines(l);'
+  $ hg record -d '1 10' -m rectest<<EOF
+  > y
+  > y
+  > n
+  > EOF
+  diff --git a/a b/a
+  2 hunks, 2 lines changed
+  examine changes to 'a'? [Ynsfdaq?] 
+  @@ -1,3 +1,4 @@
+   expand $Id$
+  +foo
+   do not process $Id:
+   xxx $
+  record change 1/2 to 'a'? [Ynsfdaq?] 
+  @@ -2,2 +3,3 @@
+   do not process $Id:
+   xxx $
+  +bar
+  record change 2/2 to 'a'? [Ynsfdaq?] 
+
+  $ hg identify
+  d17e03c92c97+ tip
+  $ hg status
+  M a
+
+Cat modified file a
+
+  $ cat a
+  expand $Id: a,v d17e03c92c97 1970/01/01 00:00:01 test $
+  foo
+  do not process $Id:
+  xxx $
+  bar
+
+Diff remaining chunk
+
+  $ hg diff | grep -v 'b/a'
+  diff -r d17e03c92c97 a
+  --- a/a	Wed Dec 31 23:59:51 1969 -0000
+  @@ -2,3 +2,4 @@
+   foo
+   do not process $Id:
+   xxx $
+  +bar
+
+  $ hg rollback
+  rolling back to revision 2 (undo commit)
+
+Record all chunks in file a
+
+  $ echo foo > msg
+
+ - do not use "hg record -m" here!
+
+  $ hg record -l msg -d '1 11'<<EOF
+  > y
+  > y
+  > y
+  > EOF
+  diff --git a/a b/a
+  2 hunks, 2 lines changed
+  examine changes to 'a'? [Ynsfdaq?] 
+  @@ -1,3 +1,4 @@
+   expand $Id$
+  +foo
+   do not process $Id:
+   xxx $
+  record change 1/2 to 'a'? [Ynsfdaq?] 
+  @@ -2,2 +3,3 @@
+   do not process $Id:
+   xxx $
+  +bar
+  record change 2/2 to 'a'? [Ynsfdaq?] 
+
+File a should be clean
+
+  $ hg status -A a
+  C a
+
+  $ rm msg
+  $ hg rollback
+  rolling back to revision 2 (undo commit)
+  $ hg update -C
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Test patch queue repo
+
+  $ hg init --mq
+  $ hg qimport -r tip -n mqtest.diff
+  $ hg commit --mq -m mqtest
+
+Keywords should not be expanded in patch
+
+  $ cat .hg/patches/mqtest.diff
+  # HG changeset patch
+  # User User Name <user@example.com>
+  # Date 1 0
+  # Node ID 40a904bbbe4cd4ab0a1f28411e35db26341a40ad
+  # Parent  ef63ca68695bc9495032c6fda1350c71e6d256e9
+  cndiff
+  
+  diff -r ef63ca68695b -r 40a904bbbe4c c
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/c	Thu Jan 01 00:00:01 1970 +0000
+  @@ -0,0 +1,2 @@
+  +$Id$
+  +tests for different changenodes
+
+  $ hg qpop
+  popping mqtest.diff
+  patch queue now empty
+
+qgoto, implying qpush, should expand
+
+  $ hg qgoto mqtest.diff
+  applying mqtest.diff
+  now at: mqtest.diff
+  $ cat c
+  $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
+  tests for different changenodes
+  $ hg cat c
+  $Id: c,v 40a904bbbe4c 1970/01/01 00:00:01 user $
+  tests for different changenodes
+
+Keywords should not be expanded in filelog
+
+  $ hg --config 'extensions.keyword=!' cat c
+  $Id$
+  tests for different changenodes
+
+qpop and move on
+
+  $ hg qpop
+  popping mqtest.diff
+  patch queue now empty
+
+Copy and show added kwfiles
+
+  $ hg cp a c
+  $ hg kwfiles
+  a
+  c
+
+Commit and show expansion in original and copy
+
+  $ hg --debug commit -ma2c -d '1 0' -u 'User Name <user@example.com>'
+  c
+   c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
+  overwriting c expanding keywords
+  committed changeset 2:25736cf2f5cbe41f6be4e6784ef6ecf9f3bbcc7d
+  $ cat a c
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  do not process $Id:
+  xxx $
+  expand $Id: c,v 25736cf2f5cb 1970/01/01 00:00:01 user $
+  do not process $Id:
+  xxx $
+
+Touch copied c and check its status
+
+  $ touch c
+  $ hg status
+
+Test different options of hg kwfiles
+
+  $ hg kwfiles
+  a
+  c
+  $ hg -v kwfiles --ignore
+  I b
+  I sym
+  $ hg kwfiles --all
+  K a
+  K c
+  I b
+  I sym
+
+Diff specific revision
+
+  $ hg diff --rev 1 | grep -v 'b/c'
+  diff -r ef63ca68695b c
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  @@ -0,0 +1,3 @@
+  +expand $Id$
+  +do not process $Id:
+  +xxx $
+
+Status after rollback:
+
+  $ hg rollback
+  rolling back to revision 1 (undo commit)
+  $ hg status
+  A c
+  $ hg update --clean
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+Custom keywordmaps as argument to kwdemo
+
+  $ hg --quiet kwdemo "Xinfo = {author}: {desc}"
+  [extensions]
+  keyword =
+  [keyword]
+  ** = 
+  b = ignore
+  demo.txt = 
+  [keywordmaps]
+  Xinfo = {author}: {desc}
+  $Xinfo: test: hg keyword configuration and expansion example $
+
+Configure custom keywordmaps
+
+  $ cat <<EOF >>$HGRCPATH
+  > [keywordmaps]
+  > Id = {file} {node|short} {date|rfc822date} {author|user}
+  > Xinfo = {author}: {desc}
+  > EOF
+
+Cat and hg cat files before custom expansion
+
+  $ cat a b
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  do not process $Id:
+  xxx $
+  ignore $Id$
+  $ hg cat sym a b && echo
+  expand $Id: a ef63ca68695b Thu, 01 Jan 1970 00:00:00 +0000 user $
+  do not process $Id:
+  xxx $
+  ignore $Id$
+  a.*
+
+Write custom keyword and prepare multiline commit message
+
+  $ echo '$Xinfo$' >> a
+  $ cat <<EOF >> log
+  > firstline
+  > secondline
+  > EOF
+
+Interrupted commit should not change state
+
+  $ hg commit
+  abort: empty commit message
+  $ hg status
+  M a
+  ? c
+  ? log
+
+Commit with multiline message and custom expansion
+
+  $ hg --debug commit -l log -d '2 0' -u 'User Name <user@example.com>'
+  a
+  overwriting a expanding keywords
+  committed changeset 2:bb948857c743469b22bbf51f7ec8112279ca5d83
+  $ rm log
+
+Stat, verify and show custom expansion (firstline)
+
+  $ hg status
+  ? c
+  $ hg verify
+  checking changesets
+  checking manifests
+  crosschecking files in changesets and manifests
+  checking files
+  3 files, 3 changesets, 4 total revisions
+  $ cat a b
+  expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: firstline $
+  ignore $Id$
+  $ hg cat sym a b && echo
+  expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: firstline $
+  ignore $Id$
+  a.*
+
+annotate
+
+  $ hg annotate a
+  1: expand $Id$
+  1: do not process $Id:
+  1: xxx $
+  2: $Xinfo$
+
+remove with status checks
+
+  $ hg debugrebuildstate
+  $ hg remove a
+  $ hg --debug commit -m rma
+  committed changeset 3:d14c712653769de926994cf7fbb06c8fbd68f012
+  $ hg status
+  ? c
+
+Rollback, revert, and check expansion
+
+  $ hg rollback
+  rolling back to revision 2 (undo commit)
+  $ hg status
+  R a
+  ? c
+  $ hg revert --no-backup --rev tip a
+  $ cat a
+  expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: firstline $
+
+Clone to test global and local configurations
+
+  $ cd ..
+
+Expansion in destinaton with global configuration
+
+  $ hg --quiet clone Test globalconf
+  $ cat globalconf/a
+  expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: firstline $
+
+No expansion in destination with local configuration in origin only
+
+  $ hg --quiet --config 'keyword.**=ignore' clone Test localconf
+  $ cat localconf/a
+  expand $Id$
+  do not process $Id:
+  xxx $
+  $Xinfo$
+
+Clone to test incoming
+
+  $ hg clone -r1 Test Test-a
+  requesting all changes
+  adding changesets
+  adding manifests
+  adding file changes
+  added 2 changesets with 3 changes to 3 files
+  updating to branch default
+  3 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ cd Test-a
+  $ cat <<EOF >> .hg/hgrc
+  > [paths]
+  > default = ../Test
+  > EOF
+  $ hg incoming
+  comparing with .*test-keyword.t/Test
+  searching for changes
+  changeset:   2:bb948857c743
+  tag:         tip
+  user:        User Name <user@example.com>
+  date:        Thu Jan 01 00:00:02 1970 +0000
+  summary:     firstline
+  
+Imported patch should not be rejected
+
+  $ sed -e 's/Id.*/& rejecttest/' a > a.new
+  $ mv a.new a
+  $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
+  a
+  overwriting a expanding keywords
+  committed changeset 2:85e279d709ffc28c9fdd1b868570985fc3d87082
+  $ hg export -o ../rejecttest.diff tip
+  $ cd ../Test
+  $ hg import ../rejecttest.diff
+  applying ../rejecttest.diff
+  $ cat a b
+  expand $Id: a 4e0994474d25 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
+  do not process $Id: rejecttest
+  xxx $
+  $Xinfo: User Name <user@example.com>: rejects? $
+  ignore $Id$
+
+  $ hg rollback
+  rolling back to revision 2 (undo commit)
+  $ hg update --clean
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+
+kwexpand/kwshrink on selected files
+
+  $ mkdir x
+  $ hg copy a x/a
+  $ hg --verbose kwexpand a
+  overwriting a expanding keywords
+
+kwexpand x/a should abort
+
+  $ hg --verbose kwexpand x/a
+  abort: outstanding uncommitted changes
+  $ cd x
+  $ hg --debug commit -m xa -d '3 0' -u 'User Name <user@example.com>'
+  x/a
+   x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
+  overwriting x/a expanding keywords
+  committed changeset 3:b4560182a3f9a358179fd2d835c15e9da379c1e4
+  $ cat a
+  expand $Id: x/a b4560182a3f9 Thu, 01 Jan 1970 00:00:03 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: xa $
+
+kwshrink a inside directory x
+
+  $ hg --verbose kwshrink a
+  overwriting x/a shrinking keywords
+  $ cat a
+  expand $Id$
+  do not process $Id:
+  xxx $
+  $Xinfo$
+  $ cd ..
+
+kwexpand nonexistent
+
+  $ hg kwexpand nonexistent
+  nonexistent:.*
+
+
+hg serve
+ - expand with hgweb file
+ - no expansion with hgweb annotate/changeset/filediff
+ - check errors
+
+  $ hg serve -p $HGPORT -d --pid-file=hg.pid -A access.log -E errors.log
+  $ cat hg.pid >> $DAEMON_PIDS
+  $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/file/tip/a/?style=raw'
+  200 Script output follows
+  
+  expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: firstline $
+  $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/annotate/tip/a/?style=raw'
+  200 Script output follows
+  
+  
+  user@1: expand $Id$
+  user@1: do not process $Id:
+  user@1: xxx $
+  user@2: $Xinfo$
+  
+  
+  
+  
+  $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/rev/tip/?style=raw'
+  200 Script output follows
+  
+  
+  # HG changeset patch
+  # User User Name <user@example.com>
+  # Date 3 0
+  # Node ID b4560182a3f9a358179fd2d835c15e9da379c1e4
+  # Parent  bb948857c743469b22bbf51f7ec8112279ca5d83
+  xa
+  
+  diff -r bb948857c743 -r b4560182a3f9 x/a
+  --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/x/a	Thu Jan 01 00:00:03 1970 +0000
+  @@ -0,0 +1,4 @@
+  +expand $Id$
+  +do not process $Id:
+  +xxx $
+  +$Xinfo$
+  
+  $ $TESTDIR/get-with-headers.py localhost:$HGPORT '/diff/bb948857c743/a?style=raw'
+  200 Script output follows
+  
+  
+  diff -r ef63ca68695b -r bb948857c743 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:02 1970 +0000
+  @@ -1,3 +1,4 @@
+   expand $Id$
+   do not process $Id:
+   xxx $
+  +$Xinfo$
+  
+  
+  
+  
+  $ cat errors.log
+
+Prepare merge and resolve tests
+
+  $ echo '$Id$' > m
+  $ hg add m
+  $ hg commit -m 4kw 
+  $ echo foo >> m
+  $ hg commit -m 5foo
+
+simplemerge
+
+  $ hg update 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo foo >> m
+  $ hg commit -m 6foo
+  created new head
+  $ hg merge
+  0 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg commit -m simplemerge
+  $ cat m
+  $Id: m 27d48ee14f67 Thu, 01 Jan 1970 00:00:00 +0000 test $
+  foo
+
+conflict: keyword should stay outside conflict zone
+
+  $ hg update 4
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ echo bar >> m
+  $ hg commit -m 8bar
+  created new head
+  $ hg merge
+  merging m
+  warning: conflicts during merge.
+  merging m failed!
+  0 files updated, 0 files merged, 0 files removed, 1 files unresolved
+  use 'hg resolve' to retry unresolved file merges or 'hg update -C' to abandon
+  $ cat m
+  $Id$
+  <<<<<<< local
+  bar
+  =======
+  foo
+  >>>>>>> other
+
+resolve to local
+
+  $ HGMERGE=internal:local hg resolve -a
+  $ hg commit -m localresolve
+  $ cat m
+  $Id: m 41efa6d38e9b Thu, 01 Jan 1970 00:00:00 +0000 test $
+  bar
+
+Test restricted mode with transplant -b
+
+  $ hg update 6
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg branch foo
+  marked working directory as branch foo
+  $ mv a a.bak
+  $ echo foobranch > a
+  $ cat a.bak >> a
+  $ rm a.bak
+  $ hg commit -m 9foobranch
+  $ hg update default
+  2 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ hg -y transplant -b foo tip
+  applying 4aa30d025d50
+  4aa30d025d50 transplanted to 5a4da427c162
+
+Expansion in changeset but not in file
+
+  $ hg tip -p
+  changeset:   11:5a4da427c162
+  tag:         tip
+  parent:      9:41efa6d38e9b
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     9foobranch
+  
+  diff -r 41efa6d38e9b -r 5a4da427c162 a
+  --- a/a	Thu Jan 01 00:00:00 1970 +0000
+  +++ b/a	Thu Jan 01 00:00:00 1970 +0000
+  @@ -1,3 +1,4 @@
+  +foobranch
+   expand $Id$
+   do not process $Id:
+   xxx $
+  
+  $ head -n 2 a
+  foobranch
+  expand $Id: a 5a4da427c162 Thu, 01 Jan 1970 00:00:00 +0000 test $
+
+Switch of expansion
+
+  $ hg -q rollback
+  $ hg -q update -C
+
+kwshrink with unknown file u
+
+  $ cp a u
+  $ hg --verbose kwshrink
+  overwriting a shrinking keywords
+  overwriting m shrinking keywords
+  overwriting x/a shrinking keywords
+
+Keywords shrunk in working directory, but not yet disabled
+ - cat shows unexpanded keywords
+ - hg cat shows expanded keywords
+
+  $ cat a b
+  expand $Id$
+  do not process $Id:
+  xxx $
+  $Xinfo$
+  ignore $Id$
+  $ hg cat sym a b && echo
+  expand $Id: a bb948857c743 Thu, 01 Jan 1970 00:00:02 +0000 user $
+  do not process $Id:
+  xxx $
+  $Xinfo: User Name <user@example.com>: firstline $
+  ignore $Id$
+  a.*
+
+Now disable keyword expansion
+
+  $ rm "$HGRCPATH"
+  $ cat a b
+  expand $Id$
+  do not process $Id:
+  xxx $
+  $Xinfo$
+  ignore $Id$
+  $ hg cat sym a b && echo
+  expand $Id$
+  do not process $Id:
+  xxx $
+  $Xinfo$
+  ignore $Id$
+  a.*