diff tests/test-relink @ 10218:750b7a4f01f6 stable

Add support for relinking on Windows. Test and minor code change by Patrick Mézard <pmezard@gmail.com>
author Siddharth Agarwal <sid.bugzilla@gmail.com>
date Fri, 08 Jan 2010 18:48:39 +0530
parents 2bbb4c8eb27e
children
line wrap: on
line diff
--- a/tests/test-relink	Fri Jan 08 22:30:07 2010 +0100
+++ b/tests/test-relink	Fri Jan 08 18:48:39 2010 +0530
@@ -3,10 +3,16 @@
 echo "[extensions]" >> $HGRCPATH
 echo "relink=" >> $HGRCPATH
 
+fix_path()
+{
+    tr '\\' /
+}
+
 cat > arelinked.py <<EOF
 import sys, os
+from mercurial import util
 path1, path2 = sys.argv[1:3]
-if os.stat(path1).st_ino == os.stat(path2).st_ino:
+if util.samefile(path1, path2):
     print '%s == %s' % (path1, path2)
 else:
     print '%s != %s' % (path1, path2)
@@ -23,6 +29,8 @@
 echo a >> a
 echo a >> b
 hg ci -Am changefiles
+# Test files are read in binary mode
+python -c "file('.hg/store/data/dummy.i', 'wb').write('a\r\nb\n')"
 cd ..
 
 echo '% clone and pull to break links'
@@ -33,9 +41,11 @@
 hg pull -q
 echo b >> b
 hg ci -m changeb
+python -c "file('.hg/store/data/dummy.i', 'wb').write('a\nb\r\n')"
 
 echo '% relink'
-hg relink --debug | sed 's:relinking.*store:relinking .hg/store:g'
+hg relink --debug | sed 's:relinking.*store:relinking .hg/store:g' \
+    | fix_path
 cd ..
 
 echo '% check hardlinks'