##// END OF EJS Templates
checklink: work around sshfs brain-damage (issue3636)...
Matt Mackall -
r19514:cfdae231 stable
parent child Browse files
Show More
@@ -154,10 +154,16 b' def checklink(path):'
154 # file already exists
154 # file already exists
155 name = tempfile.mktemp(dir=path, prefix='hg-checklink-')
155 name = tempfile.mktemp(dir=path, prefix='hg-checklink-')
156 try:
156 try:
157 os.symlink(".", name)
157 fd = tempfile.NamedTemporaryFile(dir=path, prefix='hg-checklink-')
158 os.symlink(os.path.basename(fd.name), name)
158 os.unlink(name)
159 os.unlink(name)
159 return True
160 return True
160 except (OSError, AttributeError):
161 except AttributeError:
162 return False
163 except OSError, inst:
164 # sshfs might report failure while successfully creating the link
165 if inst[0] == errno.EIO and os.path.exists(name):
166 os.unlink(name)
161 return False
167 return False
162
168
163 def checkosfilename(path):
169 def checkosfilename(path):
General Comments 0
You need to be logged in to leave comments. Login now