changeset 5094:a2c11f49e989

Merge with crew-stable
author Patrick Mezard <pmezard@gmail.com>
date Mon, 06 Aug 2007 10:57:51 +0200
parents 79373ec3f27d (current diff) 84b10dc3dccc (diff)
children 90be02035993
files mercurial/util.py
diffstat 7 files changed, 49 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1312,7 +1312,7 @@ class opener(object):
                 raise OSError(err.errno, _('could not symlink to %r: %s') %
                               (src, err.strerror), linkname)
         else:
-            f = self(self, dst, "w")
+            f = self(dst, "w")
             f.write(src)
             f.close()
 
--- a/tests/hghave
+++ b/tests/hghave
@@ -5,12 +5,38 @@ if all features are there, non-zero othe
 import optparse
 import os
 import sys
+import tempfile
 
 def has_symlink():
     return hasattr(os, "symlink")
 
+def has_fifo():
+    return hasattr(os, "mkfifo")
+
+def has_executablebit():
+    fd, path = tempfile.mkstemp()
+    os.close(fd)
+    try:
+        s = os.lstat(path).st_mode
+        os.chmod(path, s | 0100)
+        return (os.lstat(path).st_mode & 0100 != 0)
+    finally:
+        os.remove(path)
+
+def has_eol_in_paths():
+    try:
+        fd, path = tempfile.mkstemp(suffix='\n\r')
+        os.close(fd)
+        os.remove(path)
+        return True
+    except:
+        return False
+
 checks = {
     "symlink": (has_symlink, "symbolic links"),
+    "fifo": (has_fifo, "named pipes"),
+    "execbit": (has_executablebit, "executable bit"),
+    "eol-in-paths": (has_eol_in_paths, "end-of-lines in paths"),
 }
 
 def list_features():
--- a/tests/test-archive-symlinks
+++ b/tests/test-archive-symlinks
@@ -1,5 +1,7 @@
 #!/bin/sh
 
+"$TESTDIR/hghave" symlink || exit 80
+
 origdir=`pwd`
 
 cat >> readlink.py <<EOF
--- a/tests/test-clone-failure
+++ b/tests/test-clone-failure
@@ -26,10 +26,15 @@ chmod 700 a
 rm -r a b
 
 # Source of wrong type
-mkfifo a
-hg clone a b
-echo $?
-rm a
+if "$TESTDIR/hghave" -q fifo; then
+    mkfifo a
+    hg clone a b
+    echo $?
+    rm a
+else
+    echo "abort: repository a not found!"
+    echo 255
+fi
 
 # Default destination, same directory
 mkdir q
--- a/tests/test-git-import
+++ b/tests/test-git-import
@@ -44,8 +44,12 @@ copy from new
 copy to copyx
 EOF
 
-test -f copy -a ! -x copy || echo failed
-test -x copyx || echo failed
+if "$TESTDIR/hghave" -q execbit; then
+    test -f copy -a ! -x copy || echo failed
+    test -x copyx || echo failed
+else
+    test -f copy || echo failed
+fi
 cat copy
 hg cat copy
 
--- a/tests/test-issue352
+++ b/tests/test-issue352
@@ -1,6 +1,8 @@
 #!/bin/sh
 # http://www.selenic.com/mercurial/bts/issue352
 
+"$TESTDIR/hghave" eol-in-paths || exit 80
+
 hg init foo
 cd foo
 
--- a/tests/test-oldcgi
+++ b/tests/test-oldcgi
@@ -88,13 +88,13 @@ SERVER_PROTOCOL="HTTP/1.1"; export SERVE
 SERVER_SIGNATURE="<address>Apache/2.0.53 (Fedora) Server at hg.omnifarious.org Port 80</address>\; export SERVER_SIGNATURE
 "
 SERVER_SOFTWARE="Apache/2.0.53 (Fedora)"; export SERVER_SOFTWARE
-./hgweb.cgi >page1 2>&1 ; echo $?
-./hgwebdir.cgi >page2 2>&1 ; echo $?
+python hgweb.cgi >page1 2>&1 ; echo $?
+python hgwebdir.cgi >page2 2>&1 ; echo $?
 PATH_INFO="/test/"
 PATH_TRANSLATED="/var/something/test.cgi"
 REQUEST_URI="/test/test/"
 SCRIPT_URI="http://hg.omnifarious.org/test/test/"
 SCRIPT_URL="/test/test/"
-./hgwebdir.cgi >page3 2>&1 ; echo $?
+python hgwebdir.cgi >page3 2>&1 ; echo $?
 fgrep -i error page1 page2 page3 && exit 1
 exit 0