Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 13890:31eb145b50b6
util: move checklink() to posix.py and return False on Windows
Python added support for Windows 6.0 (Vista) symbolic links in 3.2 [1], but
even these symbolic links aren't what we can expect from a canonical
symbolic link, since creation requires SeCreateSymbolicLinkPrivilege,
which typically only admins have.
So we can safely assume that we don't have symbolic links on Windows.
[1] http://docs.python.org/py3k/library/os.html#os.symlink
author | Adrian Buehlmann <adrian@cadifra.com> |
---|---|
date | Tue, 05 Apr 2011 11:55:52 +0200 |
parents | 5b0a3f6cbead |
children | 98ee3dd5bab4 |
comparison
equal
deleted
inserted
replaced
13889:9a96efc4af8a | 13890:31eb145b50b6 |
---|---|
133 except (IOError, OSError): | 133 except (IOError, OSError): |
134 # we don't care, the user probably won't be able to commit anyway | 134 # we don't care, the user probably won't be able to commit anyway |
135 return False | 135 return False |
136 return not (new_file_has_exec or exec_flags_cannot_flip) | 136 return not (new_file_has_exec or exec_flags_cannot_flip) |
137 | 137 |
138 def checklink(path): | |
139 """check whether the given path is on a symlink-capable filesystem""" | |
140 # mktemp is not racy because symlink creation will fail if the | |
141 # file already exists | |
142 name = tempfile.mktemp(dir=path, prefix='hg-checklink-') | |
143 try: | |
144 os.symlink(".", name) | |
145 os.unlink(name) | |
146 return True | |
147 except (OSError, AttributeError): | |
148 return False | |
149 | |
138 def set_binary(fd): | 150 def set_binary(fd): |
139 pass | 151 pass |
140 | 152 |
141 def pconvert(path): | 153 def pconvert(path): |
142 return path | 154 return path |