Fix test-share and test-subrepo under Windows stable
authorPatrick Mezard <pmezard@gmail.com>
Sun, 14 Feb 2010 18:19:18 +0100
branchstable
changeset 10468 2250fc372d34
parent 10467 16c68fd720ab
child 10469 b26c4a89a143
Fix test-share and test-subrepo under Windows
tests/filtertmp.py
tests/test-share
tests/test-share.out
tests/test-subrepo
tests/test-subrepo.out
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/tests/filtertmp.py	Sun Feb 14 18:19:18 2010 +0100
@@ -0,0 +1,14 @@
+#!/usr/bin/env python
+#
+# This used to be a simple sed call like:
+#
+#  $ sed "s:$HGTMP:*HGTMP*:"
+#
+# But $HGTMP has ':' under Windows which breaks the sed call.
+#
+import sys, os
+
+input = sys.stdin.read()
+input = input.replace(os.environ['HGTMP'], '$HGTMP')
+input = input.replace(os.sep, '/')
+sys.stdout.write(input)
--- a/tests/test-share	Sun Feb 14 17:53:23 2010 +0100
+++ b/tests/test-share	Sun Feb 14 18:19:18 2010 +0100
@@ -19,7 +19,7 @@
   && echo "fail: .hg/store should not exist" \
   || echo "pass: .hg/store does not exist"
 # Some sed versions appends newline, some don't, and some just fails
-(cat .hg/sharedpath; echo) | head -n1 | sed "s:$HGTMP:*HGTMP*:"
+(cat .hg/sharedpath; echo) | head -n1 | "$TESTDIR/filtertmp.py"
 
 echo % commit in shared clone
 echo a >> a
--- a/tests/test-share.out	Sun Feb 14 17:53:23 2010 +0100
+++ b/tests/test-share.out	Sun Feb 14 18:19:18 2010 +0100
@@ -5,7 +5,7 @@
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
 % contents of repo2/.hg
 pass: .hg/store does not exist
-*HGTMP*/test-share/repo1/.hg
+$HGTMP/test-share/repo1/.hg
 % commit in shared clone
 % check original
 changeset:   1:8af4dc49db9e
--- a/tests/test-subrepo	Sun Feb 14 17:53:23 2010 +0100
+++ b/tests/test-subrepo	Sun Feb 14 18:19:18 2010 +0100
@@ -180,7 +180,9 @@
 hg -R main ci -m "add subrepos"
 cd ..
 hg clone mercurial/main mercurial2/main
-cat mercurial2/main/nested_absolute/.hg/hgrc mercurial2/main/nested_relative/.hg/hgrc | sed "s:${PWD}:/tmp:"
+cat mercurial2/main/nested_absolute/.hg/hgrc \
+    mercurial2/main/nested_relative/.hg/hgrc \
+    | "$TESTDIR/filtertmp.py"
 rm -rf mercurial mercurial2
 
 exit 0
--- a/tests/test-subrepo.out	Sun Feb 14 17:53:23 2010 +0100
+++ b/tests/test-subrepo.out	Sun Feb 14 18:19:18 2010 +0100
@@ -256,6 +256,6 @@
 updating to branch default
 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
 [paths]
-default = /tmp/mercurial/main/nested_absolute
+default = $HGTMP/test-subrepo/sub/mercurial/main/nested_absolute
 [paths]
-default = /tmp/mercurial/main/nested_relative
+default = $HGTMP/test-subrepo/sub/mercurial/main/nested_relative