mercurial/util.py
changeset 47417 9ea525216edb
parent 47400 9b841267253c
child 47445 d756fc11cfb9
--- a/mercurial/util.py	Tue Jun 08 03:40:36 2021 +0200
+++ b/mercurial/util.py	Mon Jun 07 21:09:31 2021 +0200
@@ -2009,8 +2009,10 @@
         if hardlink:
             try:
                 oslink(src, dst)
-            except (IOError, OSError):
-                hardlink = False
+            except (IOError, OSError) as exc:
+                if exc.errno != errno.EEXIST:
+                    hardlink = False
+                # XXX maybe try to relink if the file exist ?
                 shutil.copy(src, dst)
         else:
             shutil.copy(src, dst)