[PATCH 2 of 2] keyword: add test to unbundle null rev containing empty symlink

Christian Ebert blacktrash at gmx.net
Wed Feb 6 02:47:58 CST 2008


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1202286619 -3600
# Node ID 8b48a4f80f2d2b8a85e8b74300eb60244d17ada8
# Parent  99b48075b401b531f5c3490d4d27aee6921b7cd5
keyword: add test to unbundle null rev containing empty symlink

Would have needed yet another conditional in old structure.
Spotted by Patrick Mézard.

Use new kwcat command.

diff --git a/tests/test-keyword b/tests/test-keyword
--- a/tests/test-keyword
+++ b/tests/test-keyword
@@ -24,17 +24,29 @@
 
 hg --quiet kwdemo "Branch = {branches}"
 
+hg init t
+cd t
+echo % kwshrink should exit silently in empty/invalid repo
+hg kwshrink
+
+echo % symlink nonexisting file
+ln -s a sym
+echo % commit hook must fail with missing file
+hg --debug commit -A -msym -d '0 0' -u 'User Name <user at example.com>'
+echo % bundle null revision containing empty symlink
+hg bundle --base null ../test-keyword.hg
+cd ..
+
 hg init Test
 cd Test
 
-echo % kwshrink should exit silently in empty/invalid repo
-hg kwshrink
+echo % pull from bundle
+hg pull --traceback -u ../test-keyword.hg
 
 echo 'expand $Id$' > a
 echo 'do not process $Id:' >> a
 echo 'xxx $' >> a
 echo 'ignore $Id$' > b
-ln -s a sym
 echo % cat
 cat sym a b
 
@@ -50,15 +62,15 @@
 hg status
 
 echo % commit
-hg --debug commit -mabsym -d '0 0' -u 'User Name <user at example.com>'
+hg --debug commit -mabsym -d '1 0' -u 'User Name <user at example.com>'
 echo % status
 hg status
 echo % identify
 hg --quiet identify
 echo % cat
 cat sym a b
-echo % hg cat
-hg cat sym a b
+echo % hg kwcat
+hg kwcat sym a b
 
 echo
 echo % diff a hooktest
@@ -84,14 +96,18 @@
 echo '$Id$' > c
 echo 'tests for different changenodes' >> c
 echo % commit c
-hg commit -A -mcndiff -d '1 0' -u 'User Name <user at example.com>'
+hg commit -A -mcndiff -d '2 0' -u 'User Name <user at example.com>'
 echo % force expansion
 hg -v kwexpand
 echo % compare changenodes in a c
 cat a c
 
+echo % qinit -c
+hg qinit -c
 echo % qimport
 hg qimport -r tip -n mqtest.diff
+echo % qcommit
+hg qcommit -mqtest
 echo % keywords should not be expanded in patch
 cat .hg/patches/mqtest.diff
 echo % qpop
@@ -110,7 +126,7 @@
 hg kwfiles
 
 echo % commit
-hg --debug commit -ma2c -d '1 0' -u 'User Name <user at example.com>'
+hg --debug commit -ma2c -d '2 0' -u 'User Name <user at example.com>'
 echo % cat a c
 cat a c
 echo % touch copied c after 1 second
@@ -123,7 +139,7 @@
 hg kwfiles
 
 echo % diff --rev
-hg diff --rev 0 | grep -v 'b/c'
+hg diff --rev 1 | grep -v 'b/c'
 
 echo % rollback
 hg rollback
@@ -144,8 +160,8 @@
 
 echo % cat
 cat sym a b
-echo % hg cat
-hg cat sym a b
+echo % hg kwcat
+hg kwcat sym a b
 
 echo
 echo '$Xinfo$' >> a
@@ -160,15 +176,15 @@
 hg status
 
 echo % commit
-hg --debug commit -l log -d '2 0' -u 'User Name <user at example.com>'
+hg --debug commit -l log -d '3 0' -u 'User Name <user at example.com>'
 rm log
 echo % status
 hg status
 
 echo % cat
 cat sym a b
-echo % hg cat
-hg cat sym a b
+echo % hg kwcat
+hg kwcat sym a b
 echo
 
 echo % remove
@@ -187,7 +203,7 @@
 
 echo % clone to test incoming
 cd ..
-hg clone -r0 Test Test-a
+hg clone -r1 Test Test-a
 cd Test-a
 cat <<EOF >> .hg/hgrc
 [paths]
@@ -200,7 +216,7 @@
 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 at example.com>'
+hg --debug commit -m'rejects?' -d '4 0' -u 'User Name <user at example.com>'
 echo % export
 hg export -o ../rejecttest.diff tip
 
@@ -224,7 +240,7 @@
 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 at example.com>'
+hg --debug commit -m xa -d '4 0' -u 'User Name <user at example.com>'
 echo % cat a
 cat a
 echo % kwshrink a inside directory x
@@ -236,18 +252,11 @@
 echo % kwexpand nonexistent
 hg kwexpand nonexistent
 
-echo % switch off expansion
 echo % kwshrink with unknown file u
 cp a u
 hg --verbose kwshrink
 echo % cat
 cat sym a b
-echo % hg cat
-hg cat sym a b
+echo % hg kwcat
+hg kwcat sym a b
 echo
-rm $HGRCPATH
-echo % cat
-cat sym a b
-echo % hg cat
-hg cat sym a b
-echo
diff --git a/tests/test-keyword.out b/tests/test-keyword.out
--- a/tests/test-keyword.out
+++ b/tests/test-keyword.out
@@ -46,6 +46,7 @@
 
 list of commands:
 
+ kwcat      output the current or given revision of files expanding keywords
  kwdemo     print [keywordmaps] configuration and an expansion example
  kwexpand   expand keywords in working directory
  kwfiles    print files currently configured for keyword expansion
@@ -84,6 +85,23 @@
 Branch = {branches}
 $Branch: demobranch $
 % kwshrink should exit silently in empty/invalid repo
+% symlink nonexisting file
+% commit hook must fail with missing file
+cp: a: No such file or directory
+adding sym
+sym
+running hook commit.test: cp a hooktest
+warning: commit.test hook exited with status 1
+% bundle null revision containing empty symlink
+1 changesets found
+% pull from bundle
+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:
@@ -95,43 +113,38 @@
 % addremove
 adding a
 adding b
-adding sym
 % status
 A a
 A b
-A sym
 % default keyword expansion including commit hook
 % interrupted commit should not change state or run commit hook
 a
 b
-sym
 transaction abort!
 rollback completed
 abort: empty commit message
 % status
 A a
 A b
-A sym
 % commit
 a
 b
-sym
 overwriting a expanding keywords
 running hook commit.test: cp a hooktest
 % status
 ? hooktest
 % identify
-f782df5f9602
+cecf1e2cc3d3
 % cat
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
 ignore $Id$
-% hg cat
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+% hg kwcat
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
 ignore $Id$
@@ -143,10 +156,10 @@
 % update
 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % cat
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
 ignore $Id$
@@ -157,23 +170,25 @@
 overwriting a expanding keywords
 overwriting c expanding keywords
 % compare changenodes in a c
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
-$Id: c,v ba4426d1938e 1970/01/01 00:00:01 user $
+$Id: c,v c033759cd8fd 1970/01/01 00:00:02 user $
 tests for different changenodes
+% qinit -c
 % qimport
+% qcommit
 % keywords should not be expanded in patch
 # HG changeset patch
 # User User Name <user at example.com>
-# Date 1 0
-# Node ID ba4426d1938ec9673e03ab274d88c44e24618f7f
-# Parent  f782df5f9602483b4e51c31a12315f353bba380c
+# Date 2 0
+# Node ID c033759cd8fd162b7863dc4e5d1eea433603880f
+# Parent  cecf1e2cc3d3447fcc20dd4eac5c4faa8a615df3
 cndiff
 
-diff -r f782df5f9602 -r ba4426d1938e c
+diff -r cecf1e2cc3d3 -r c033759cd8fd c
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
-+++ b/c	Thu Jan 01 00:00:01 1970 +0000
++++ b/c	Thu Jan 01 00:00:02 1970 +0000
 @@ -0,0 +1,2 @@
 +$Id$
 +tests for different changenodes
@@ -183,7 +198,7 @@
 applying mqtest.diff
 Now at: mqtest.diff
 % cat
-$Id: c,v ba4426d1938e 1970/01/01 00:00:01 user $
+$Id: c,v c033759cd8fd 1970/01/01 00:00:02 user $
 tests for different changenodes
 % qpop and move on
 Patch queue now empty
@@ -196,10 +211,10 @@
  c: copy a:0045e12f6c5791aac80ca6cbfd97709a88307292
 overwriting c expanding keywords
 % cat a c
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
-expand $Id: c,v 0ba462c0f077 1970/01/01 00:00:01 user $
+expand $Id: c,v 1fed52d26fd0 1970/01/01 00:00:02 user $
 do not process $Id:
 xxx $
 % touch copied c after 1 second
@@ -208,7 +223,7 @@
 a
 c
 % diff --rev
-diff -r f782df5f9602 c
+diff -r cecf1e2cc3d3 c
 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
 @@ -0,0 +1,3 @@
 +expand $Id$
@@ -232,15 +247,15 @@
 Xinfo = {author}: {desc}
 $Xinfo: test: hg keyword config and expansion example $
 % cat
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
-expand $Id: a,v f782df5f9602 1970/01/01 00:00:00 user $
+expand $Id: a,v cecf1e2cc3d3 1970/01/01 00:00:01 user $
 do not process $Id:
 xxx $
 ignore $Id$
-% hg cat
-expand $Id: a f782df5f9602 Thu, 01 Jan 1970 00:00:00 +0000 user $
+% hg kwcat
+expand $Id: a cecf1e2cc3d3 Thu, 01 Jan 1970 00:00:01 +0000 user $
 do not process $Id:
 xxx $
 ignore $Id$
@@ -257,17 +272,17 @@
 overwriting a expanding keywords
 % status
 % cat
-expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
+expand $Id: a a576e5647736 Thu, 01 Jan 1970 00:00:03 +0000 user $
 do not process $Id:
 xxx $
 $Xinfo: User Name <user at example.com>: firstline $
-expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
+expand $Id: a a576e5647736 Thu, 01 Jan 1970 00:00:03 +0000 user $
 do not process $Id:
 xxx $
 $Xinfo: User Name <user at example.com>: firstline $
 ignore $Id$
-% hg cat
-expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
+% hg kwcat
+expand $Id: a a576e5647736 Thu, 01 Jan 1970 00:00:03 +0000 user $
 do not process $Id:
 xxx $
 $Xinfo: User Name <user at example.com>: firstline $
@@ -281,7 +296,7 @@
 R a
 % revert a
 % cat a
-expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
+expand $Id: a a576e5647736 Thu, 01 Jan 1970 00:00:03 +0000 user $
 do not process $Id:
 xxx $
 $Xinfo: User Name <user at example.com>: firstline $
@@ -290,15 +305,15 @@
 adding changesets
 adding manifests
 adding file changes
-added 1 changesets with 3 changes to 3 files
+added 2 changesets with 3 changes to 3 files
 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % incoming
 comparing with test-keyword/Test
 searching for changes
-changeset:   1:0729690beff6
+changeset:   2:a576e5647736
 tag:         tip
 user:        User Name <user at example.com>
-date:        Thu Jan 01 00:00:02 1970 +0000
+date:        Thu Jan 01 00:00:03 1970 +0000
 summary:     firstline
 
 % commit rejecttest
@@ -308,11 +323,11 @@
 % import
 applying ../rejecttest.diff
 % cat
-expand $Id: a 82983f13f138 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
+expand $Id: a 97b8d4afd122 Thu, 01 Jan 1970 00:00:04 +0000 user $ rejecttest
 do not process $Id: rejecttest
 xxx $
 $Xinfo: User Name <user at example.com>: rejects? $
-expand $Id: a 82983f13f138 Thu, 01 Jan 1970 00:00:03 +0000 user $ rejecttest
+expand $Id: a 97b8d4afd122 Thu, 01 Jan 1970 00:00:04 +0000 user $ rejecttest
 do not process $Id: rejecttest
 xxx $
 $Xinfo: User Name <user at example.com>: rejects? $
@@ -332,7 +347,7 @@
  x/a: copy a:779c764182ce5d43e2b1eb66ce06d7b47bfe342e
 overwriting x/a expanding keywords
 % cat a
-expand $Id: x/a f27c134d2d9b Thu, 01 Jan 1970 00:00:03 +0000 user $
+expand $Id: x/a 6ae8e7fbf16c Thu, 01 Jan 1970 00:00:04 +0000 user $
 do not process $Id:
 xxx $
 $Xinfo: User Name <user at example.com>: xa $
@@ -345,7 +360,6 @@
 $Xinfo$
 % kwexpand nonexistent
 nonexistent: No such file or directory
-% switch off expansion
 % kwshrink with unknown file u
 overwriting a shrinking keywords
 overwriting x/a shrinking keywords
@@ -359,27 +373,10 @@
 xxx $
 $Xinfo$
 ignore $Id$
-% hg cat
-expand $Id: a 0729690beff6 Thu, 01 Jan 1970 00:00:02 +0000 user $
+% hg kwcat
+expand $Id: a a576e5647736 Thu, 01 Jan 1970 00:00:03 +0000 user $
 do not process $Id:
 xxx $
 $Xinfo: User Name <user at example.com>: firstline $
 ignore $Id$
 a
-% cat
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-ignore $Id$
-% hg cat
-expand $Id$
-do not process $Id:
-xxx $
-$Xinfo$
-ignore $Id$
-a


More information about the Mercurial-devel mailing list