Patchwork D10854: copyfiles: add a way to relax the file system checking for hardlink

login
register
mail settings
Submitter phabricator
Date June 9, 2021, 2:39 p.m.
Message ID <differential-rev-PHID-DREV-e7yr6l6v2hvnc5wt4wwk-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49175/
State Superseded
Headers show

Comments

phabricator - June 9, 2021, 2:39 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  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.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D10854

AFFECTED FILES
  mercurial/util.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1918,6 +1918,7 @@ 
     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
@@ -1936,7 +1937,7 @@ 
         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: