[PATCH] Make test-hardlinks-safety portable (one more for the road)
Christian Ebert
blacktrash at gmx.net
Wed Aug 20 11:00:13 CDT 2008
# HG changeset patch
# User Christian Ebert <blacktrash at gmx.net>
# Date 1219247892 -7200
# Node ID c2c7f7676c1a7ecd0c04febdcdfcf35d3b815959
# Parent 7d1713353aaf24a31d358c7934868e4d31843ee2
Make test-hardlinks-safety portable
On some systems cp cannot create/preserve hardlinks.
Use util.copyfiles instead, after making sure it actually does
create hardlinks.
diff --git a/tests/test-hardlinks-safety b/tests/test-hardlinks-safety
--- a/tests/test-hardlinks-safety
+++ b/tests/test-hardlinks-safety
@@ -1,4 +1,20 @@
#!/bin/sh
+
+# some implementations of cp can't create hardlinks
+cat > cp.py <<EOF
+from mercurial import util
+import sys
+util.copyfiles(sys.argv[1], sys.argv[2], hardlink=True)
+EOF
+
+# test hardlinking outside hg
+mkdir x
+echo foo > x/a
+
+python cp.py x y
+echo bar >> y/a
+echo % no diff if hardlink
+diff x/a y/a
# test mq hardlinking
echo "[extensions]" >> $HGRCPATH
@@ -21,7 +37,7 @@
hg qpush
cd ..
-cp -al a b
+python cp.py a b
cd b
hg qimport -n bar - << EOF
@@ -51,7 +67,7 @@
hg tag foo
cd ..
-cp -al b c
+python cp.py b c
cd c
hg tag -l -r 0 lbar
diff --git a/tests/test-hardlinks-safety.out b/tests/test-hardlinks-safety.out
--- a/tests/test-hardlinks-safety.out
+++ b/tests/test-hardlinks-safety.out
@@ -1,3 +1,4 @@
+% no diff if hardlink
% init
adding foo to series file
applying foo
More information about the Mercurial-devel
mailing list