[PATCH 3 of 7] tests: dump journal file by python script instead of sed for portability

FUJIWARA Katsunori foozy at lares.dti.ne.jp
Fri Feb 5 08:53:36 EST 2016


# HG changeset patch
# User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
# Date 1454679125 -32400
#      Fri Feb 05 22:32:05 2016 +0900
# Node ID dd15544db8921d6fb73a0b5b5204f352476a2fa6
# Parent  42fff041b3fb7fe2adcd494fe81bff431880dd1c
tests: dump journal file by python script instead of sed for portability

Before this patch, test-repair-strip.t fails on Solaris, because of
"sed" on it doesn't work as expected if input contains null ('\0')
character.

diff --git a/tests/test-repair-strip.t b/tests/test-repair-strip.t
--- a/tests/test-repair-strip.t
+++ b/tests/test-repair-strip.t
@@ -1,5 +1,12 @@
 #require unix-permissions no-root
 
+  $ cat > $TESTTMP/dumpjournal.py <<EOF
+  > import sys
+  > for entry in sys.stdin.read().split('\n'):
+  >     if entry:
+  >         print entry.split('\x00')[0]
+  > EOF
+
   $ echo "[extensions]" >> $HGRCPATH
   $ echo "mq=">> $HGRCPATH
 
@@ -14,7 +21,7 @@
   >   hg verify
   >   echo % journal contents
   >   if [ -f .hg/store/journal ]; then
-  >       sed -e 's/\.i[^\n]*/\.i/' .hg/store/journal
+  >       cat .hg/store/journal | python $TESTTMP/dumpjournal.py
   >   else
   >       echo "(no journal)"
   >   fi


More information about the Mercurial-devel mailing list