diff mercurial/util.py @ 31583:e7a02e9ad162

util: enable hardlink for copyfile This patch removes the global variable "allowhardlinks" that disables hardlink in all cases, so hardlink gets enabled if the filesystem type is whitelisted. Third party extensions wanting to enable hardlink support unconditionally can replace "_hardlinkfswhitelist.__contains__".
author Jun Wu <quark@fb.com>
date Sun, 12 Mar 2017 01:03:23 -0800
parents e506e461c7a9
children ae02cc1f5369
line wrap: on
line diff
--- a/mercurial/util.py	Sun Mar 12 00:26:20 2017 -0800
+++ b/mercurial/util.py	Sun Mar 12 01:03:23 2017 -0800
@@ -1055,11 +1055,6 @@
 
     return check
 
-# Hardlinks are problematic on CIFS, do not allow hardlinks
-# until we find a way to work around it cleanly (issue4546).
-# This is a variable so extensions can opt-in to using them.
-allowhardlinks = False
-
 # a whilelist of known filesystems where hardlink works reliably
 _hardlinkfswhitelist = set([
     'btrfs',
@@ -1095,7 +1090,7 @@
         fstype = getattr(osutil, 'getfstype', lambda x: None)(destdir)
         if fstype not in _hardlinkfswhitelist:
             hardlink = False
-    if allowhardlinks and hardlink:
+    if hardlink:
         try:
             oslink(src, dest)
             return