tests: teach hghave to actually test for symlink support stable
authorMatt Mackall <mpm@selenic.com>
Sat, 31 Mar 2012 10:44:31 -0500
branchstable
changeset 1055 dabed2cabd5e
parent 1053 ede95d3a1f27
child 1056 0e6cee08a2f8
tests: teach hghave to actually test for symlink support [ original upstream message ]
tests/hghave
--- a/tests/hghave	Sat Sep 11 10:57:35 2010 +0200
+++ b/tests/hghave	Sat Mar 31 10:44:31 2012 -0500
@@ -161,6 +161,15 @@
     return matchoutput('p4 -V', r'Rev\. P4/') and matchoutput('p4d -V', r'Rev\. P4D/')
 
 def has_symlink():
+    if not hasattr(os, "symlink"):
+        return False
+    name = tempfile.mktemp(dir=".", prefix='hg-checklink-')
+    try:
+        os.symlink(".", name)
+        os.unlink(name)
+        return True
+    except (OSError, AttributeError):
+        return False
     return hasattr(os, "symlink") # FIXME: should also check file system and os
 
 def has_tla():