checknlink: return False if .hgtmp file preexists (issue2517) stable
authorAdrian Buehlmann <adrian@cadifra.com>
Tue, 23 Nov 2010 22:53:47 +0100
branchstable
changeset 13038 670f4e98276d
parent 13035 f08df4d38442
child 13039 dd24f3e7ca9e
checknlink: return False if .hgtmp file preexists (issue2517) If os_link fails on Windows, errno is always errno.EINVAL, so we can't really say if the testlink could not be created because (a) the FS doesn't support hardlinks or (b) there is a leaked .hgtmp file lying around from a previous crashed run. So let's err on the safe side, keep the code simple and assume we can't detect hardlinks in both cases.
mercurial/util.py
--- a/mercurial/util.py	Tue Nov 16 13:06:07 2010 -0600
+++ b/mercurial/util.py	Tue Nov 23 22:53:47 2010 +0100
@@ -722,10 +722,7 @@
 
     try:
         os_link(testfile, f)
-    except OSError, inst:
-        if inst.errno == errno.EINVAL:
-            # FS doesn't support creating hardlinks
-            return True
+    except OSError:
         return False
 
     try: