--- a/mercurial/posix.py Sat Jul 27 19:31:14 2013 -0500
+++ b/mercurial/posix.py Sun Jul 28 15:02:32 2013 -0500
@@ -154,10 +154,16 @@
# file already exists
name = tempfile.mktemp(dir=path, prefix='hg-checklink-')
try:
- os.symlink(".", name)
+ fd = tempfile.NamedTemporaryFile(dir=path, prefix='hg-checklink-')
+ os.symlink(os.path.basename(fd.name), name)
os.unlink(name)
return True
- except (OSError, AttributeError):
+ except AttributeError:
+ return False
+ except OSError, inst:
+ # sshfs might report failure while successfully creating the link
+ if inst[0] == errno.EIO and os.path.exists(name):
+ os.unlink(name)
return False
def checkosfilename(path):