Mercurial > public > mercurial-scm > hg
comparison mercurial/posix.py @ 27236:b0d90fef16b6
posix: work around "posix" systems without os.link available (issue4974)
Some platforms (see bug, notably a terminal emulator on Android) ship
with os.link removed from Python to try and cater to other tools that
expect os.link to exist iff hardlinks are supported on that
platform. As a workaround for this madness, include a fallback path
for when we're on a "posix" platform but lack os.link.
author | Augie Fackler <augie@google.com> |
---|---|
date | Fri, 04 Dec 2015 15:59:46 -0500 |
parents | 0e3d093c468e |
children | c220434a3461 |
comparison
equal
deleted
inserted
replaced
27235:054cd38a2f19 | 27236:b0d90fef16b6 |
---|---|
27 ) | 27 ) |
28 | 28 |
29 posixfile = open | 29 posixfile = open |
30 normpath = os.path.normpath | 30 normpath = os.path.normpath |
31 samestat = os.path.samestat | 31 samestat = os.path.samestat |
32 oslink = os.link | 32 try: |
33 oslink = os.link | |
34 except AttributeError: | |
35 # Some platforms build Python without os.link on systems that are | |
36 # vaguely unix-like but don't have hardlink support. For those | |
37 # poor souls, just say we tried and that it failed so we fall back | |
38 # to copies. | |
39 def oslink(src, dst): | |
40 raise OSError(errno.EINVAL, | |
41 'hardlinks not supported: %s to %s' % (src, dst)) | |
33 unlink = os.unlink | 42 unlink = os.unlink |
34 rename = os.rename | 43 rename = os.rename |
35 removedirs = os.removedirs | 44 removedirs = os.removedirs |
36 expandglobs = False | 45 expandglobs = False |
37 | 46 |