[PATCH 5 of 6] test-keyword: remove remaining sed calls

Christian Ebert blacktrash at gmx.net
Mon Oct 4 11:02:24 CDT 2010


# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1286195181 -7200
# Node ID acc30d1d3d97b02fdfeb306c68045be5ef818ecc
# Parent  c5dfc3e3041cd7f089ee733a37d78bfad7a02e01
test-keyword: remove remaining sed calls

diff --git a/tests/test-keyword.t b/tests/test-keyword.t
--- a/tests/test-keyword.t
+++ b/tests/test-keyword.t
@@ -50,6 +50,9 @@
   > b = ignore
   > i = ignore
   > [hooks]
+  > EOF
+  $ cp $HGRCPATH $HGRCPATH.nohooks
+  > cat <<EOF >> $HGRCPATH
   > commit=
   > commit.test=cp a hooktest
   > EOF
@@ -157,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
@@ -247,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
 
@@ -730,8 +727,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 at example.com>'
   a
   overwriting a expanding keywords


More information about the Mercurial-devel mailing list