tests/test-keyword.t
branchstable
changeset 820 67c17a447d99
parent 818 b742a071ad9c
child 821 04cb1661adc8
--- a/tests/test-keyword.t	Sun Sep 26 21:59:47 2010 +0200
+++ b/tests/test-keyword.t	Sat Oct 09 11:52:32 2010 +0100
@@ -48,7 +48,11 @@
   > [keyword]
   > ** =
   > b = ignore
+  > i = ignore
   > [hooks]
+  > EOF
+  $ cp $HGRCPATH $HGRCPATH.nohooks
+  > cat <<EOF >> $HGRCPATH
   > commit=
   > commit.test=cp a hooktest
   > EOF
@@ -156,10 +160,7 @@
 
   $ diff a hooktest
 
-Removing commit hook from config
-
-  $ sed -e '/\[hooks\]/,$ d' "$HGRCPATH" > $HGRCPATH.nohook
-  $ mv "$HGRCPATH".nohook "$HGRCPATH"
+  $ cp $HGRCPATH.nohooks $HGRCPATH
   $ rm hooktest
 
 bundle
@@ -246,10 +247,7 @@
   +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"
+  $ cp $HGRCPATH.nohooks $HGRCPATH
 
 Touch files and check with status
 
@@ -375,7 +373,6 @@
 
   $ hg status -A a
   C a
-  $ rm msg
 
 rollback and revert expansion
 
@@ -420,6 +417,25 @@
   $ hg update -C
   1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 
+record added file
+
+  $ echo '$Id$' > r
+  $ hg add r
+  $ hg -v record -l msg -d '1 12' r<<EOF
+  > y
+  > EOF
+  diff --git a/r b/r
+  new file mode 100644
+  examine changes to 'r'? [Ynsfdaq?] 
+  r
+  committed changeset 3:899491280810
+  overwriting r expanding keywords
+  $ hg --verbose rollback
+  rolling back to revision 2 (undo commit)
+  overwriting r shrinking keywords
+  $ hg forget r
+  $ rm msg r
+
 Test patch queue repo
 
   $ hg init --mq
@@ -498,6 +514,38 @@
   $ touch c
   $ hg status
 
+Copy kwfile to keyword ignored file unexpanding keywords
+
+  $ hg --verbose copy a i
+  copying a to i
+  overwriting i shrinking keywords
+  $ head -n 1 i
+  expand $Id$
+  $ hg forget i
+  $ rm i
+
+Copy ignored file to ignored file: no overwriting
+
+  $ hg --verbose copy b i
+  copying b to i
+  $ hg forget i
+  $ rm i
+
+cp symlink (becomes regular file), and hg copy after
+
+  $ cp sym i
+  $ ls -l i
+  -rw-r--r--  * (glob)
+  $ head -1 i
+  expand $Id: a,v ef63ca68695b 1970/01/01 00:00:00 user $
+  $ hg copy --after --verbose sym i
+  copying sym to i
+  overwriting i shrinking keywords
+  $ head -1 i
+  expand $Id$
+  $ hg forget i
+  $ rm i
+
 Test different options of hg kwfiles
 
   $ hg kwfiles
@@ -541,6 +589,7 @@
   ** = 
   b = ignore
   demo.txt = 
+  i = ignore
   [keywordmaps]
   Xinfo = {author}: {desc}
   $Xinfo: test: hg keyword configuration and expansion example $
@@ -696,8 +745,8 @@
   
 Imported patch should not be rejected
 
-  $ sed -e 's/Id.*/& rejecttest/' a > a.new
-  $ mv a.new a
+  $ python -c \
+  > 'import re; s=re.sub("(Id.*)","\\1 rejecttest",open("a").read()); open("a","wb").write(s);'
   $ hg --debug commit -m'rejects?' -d '3 0' -u 'User Name <user@example.com>'
   a
   overwriting a expanding keywords