# HG changeset patch # User Pierre-Yves David # Date 2021-06-09 13:33:58 # Node ID 09ff5d532a256e14f7f230162155d5d4ed97f452 # Parent d756fc11cfb9deba8f7191995ef42807c53090db copyfiles: add a way to relax the file system checking for hardlink This is critical for transaction file, less for hardlink/copy clone as we are about to do. Since `pure` build does not have a `getfstype` implementation this would disable hardlink clone for all pure build. So we add a parameter to control that extra check. Differential Revision: https://phab.mercurial-scm.org/D10854 diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1917,6 +1917,7 @@ def copyfile( checkambig=False, nb_bytes=None, no_hardlink_cb=None, + check_fs_hardlink=True, ): """copy a file, preserving mode and optionally other stat info like atime/mtime @@ -1935,7 +1936,7 @@ def copyfile( if checkambig: oldstat = checkambig and filestat.frompath(dest) unlink(dest) - if hardlink: + if hardlink and check_fs_hardlink: # Hardlinks are problematic on CIFS (issue4546), do not allow hardlinks # unless we are confident that dest is on a whitelisted filesystem. try: