diff tests/test-mq.t @ 16331:900767dfa80d stable

tests: fix portability of sed usage in test-mq on some platform (Mac OS X and Solaris, at least), to insert new text line, sed function 'i' should be followed by: - backslash('\'), - new-line, - text to be inserted and - new-line GNU sed on Linux can recognize both previous and new ones as same modification request. in addition to it, this patch avoids to use '-i' option for sed, because it is not so portable, as noted in WritingTests wiki page.
author FUJIWARA Katsunori <foozy@lares.dti.ne.jp>
date Sun, 01 Apr 2012 18:18:48 +0900
parents 7c76587fb372
children 41b41adba08a
line wrap: on
line diff
--- a/tests/test-mq.t	Sat Mar 31 13:46:46 2012 -0500
+++ b/tests/test-mq.t	Sun Apr 01 18:18:48 2012 +0900
@@ -519,7 +519,10 @@
   $ hg qpush --move test.patch # already applied
   abort: cannot push to a previous patch: test.patch
   [255]
-  $ sed -i.bak '2i\# make qtip index different in series and fullseries' `hg root`/.hg/patches/series
+  $ sed '2i\
+  > # make qtip index different in series and fullseries
+  > ' `hg root`/.hg/patches/series > $TESTTMP/sedtmp
+  $ cp $TESTTMP/sedtmp `hg root`/.hg/patches/series
   $ cat `hg root`/.hg/patches/series
   # comment
   # make qtip index different in series and fullseries
@@ -1496,12 +1499,14 @@
 
 (restore env for next test)
 
-  $ sed -i.bak -e 's/new-commit=secret//' $HGRCPATH
+  $ sed -e 's/new-commit=secret//' $HGRCPATH > $TESTTMP/sedtmp
+  $ cp $TESTTMP/sedtmp $HGRCPATH
   $ hg qimport -r 1 --name  add-file2
 
 Test that qfinish preserve phase when mq.secret=false
 
-  $ sed -i.bak -e 's/secret=true/secret=false/' $HGRCPATH
+  $ sed -e 's/secret=true/secret=false/' $HGRCPATH > $TESTTMP/sedtmp
+  $ cp $TESTTMP/sedtmp $HGRCPATH
   $ hg qfinish qbase
   patch add-file2 finalized without changeset message
   $ hg phase 'all()'