mercurial/posix.py
changeset 27236 b0d90fef16b6
parent 26901 0e3d093c468e
child 27362 c220434a3461
--- a/mercurial/posix.py	Thu Dec 03 13:14:20 2015 -0800
+++ b/mercurial/posix.py	Fri Dec 04 15:59:46 2015 -0500
@@ -29,7 +29,16 @@
 posixfile = open
 normpath = os.path.normpath
 samestat = os.path.samestat
-oslink = os.link
+try:
+    oslink = os.link
+except AttributeError:
+    # Some platforms build Python without os.link on systems that are
+    # vaguely unix-like but don't have hardlink support. For those
+    # poor souls, just say we tried and that it failed so we fall back
+    # to copies.
+    def oslink(src, dst):
+        raise OSError(errno.EINVAL,
+                      'hardlinks not supported: %s to %s' % (src, dst))
 unlink = os.unlink
 rename = os.rename
 removedirs = os.removedirs