# HG changeset patch # User Patrick Mezard # Date 1186390671 -7200 # Node ID a2c11f49e989cac7498da49e43a4927dec418f66 # Parent 79373ec3f27d719afaec3a69d38aedc4a5a9e610# Parent 84b10dc3dccc2a3629d386cd0aff4c3c0500dc53 Merge with crew-stable diff --git a/mercurial/util.py b/mercurial/util.py --- 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() diff --git a/tests/hghave b/tests/hghave --- 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(): diff --git a/tests/test-archive-symlinks b/tests/test-archive-symlinks --- 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 <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