diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -1055,11 +1055,6 @@ def checksignature(func): 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 @@ def copyfile(src, dest, hardlink=False, 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 diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks-whitelisted.t copy from tests/test-hardlinks.t copy to tests/test-hardlinks-whitelisted.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks-whitelisted.t @@ -1,4 +1,10 @@ #require hardlink +#require hardlink-whitelisted + +This test is similar to test-hardlinks.t, but will only run on some filesystems +that we are sure to have known good hardlink supports (see issue4546 for an +example where the filesystem claims hardlink support but is actually +problematic). $ cat > nlinks.py < import sys @@ -166,7 +172,7 @@ Push to repo r1 should break up most har 1 r2/.hg/store/00manifest.i 1 r2/.hg/store/data/d1/f2.i 2 r2/.hg/store/data/f1.i - 1 r2/.hg/store/fncache + 2 r2/.hg/store/fncache $ hg -R r2 verify checking changesets @@ -191,7 +197,7 @@ Committing a change to f1 in r1 must bre 1 r2/.hg/store/00manifest.i 1 r2/.hg/store/data/d1/f2.i 1 r2/.hg/store/data/f1.i - 1 r2/.hg/store/fncache + 2 r2/.hg/store/fncache $ cd r3 @@ -233,11 +239,11 @@ r4 has hardlinks in the working dir (not 2 r4/.hg/store/undo.backup.phaseroots 2 r4/.hg/store/undo.backupfiles 2 r4/.hg/store/undo.phaseroots - 2 r4/.hg/undo.backup.dirstate + 4 r4/.hg/undo.backup.dirstate 2 r4/.hg/undo.bookmarks 2 r4/.hg/undo.branch 2 r4/.hg/undo.desc - 2 r4/.hg/undo.dirstate + 4 r4/.hg/undo.dirstate 2 r4/d1/data1 2 r4/d1/f2 2 r4/f1 @@ -272,11 +278,11 @@ Update back to revision 11 in r4 should 2 r4/.hg/store/undo.backup.phaseroots 2 r4/.hg/store/undo.backupfiles 2 r4/.hg/store/undo.phaseroots - 2 r4/.hg/undo.backup.dirstate + 4 r4/.hg/undo.backup.dirstate 2 r4/.hg/undo.bookmarks 2 r4/.hg/undo.branch 2 r4/.hg/undo.desc - 2 r4/.hg/undo.dirstate + 4 r4/.hg/undo.dirstate 2 r4/d1/data1 2 r4/d1/f2 1 r4/f1 diff --git a/tests/test-hardlinks.t b/tests/test-hardlinks.t --- a/tests/test-hardlinks.t +++ b/tests/test-hardlinks.t @@ -166,7 +166,7 @@ Push to repo r1 should break up most har 1 r2/.hg/store/00manifest.i 1 r2/.hg/store/data/d1/f2.i 2 r2/.hg/store/data/f1.i - 1 r2/.hg/store/fncache + [12] r2/\.hg/store/fncache (re) $ hg -R r2 verify checking changesets @@ -191,7 +191,7 @@ Committing a change to f1 in r1 must bre 1 r2/.hg/store/00manifest.i 1 r2/.hg/store/data/d1/f2.i 1 r2/.hg/store/data/f1.i - 1 r2/.hg/store/fncache + [12] r2/\.hg/store/fncache (re) $ cd r3 @@ -233,11 +233,11 @@ r4 has hardlinks in the working dir (not 2 r4/.hg/store/undo.backup.phaseroots 2 r4/.hg/store/undo.backupfiles 2 r4/.hg/store/undo.phaseroots - 2 r4/.hg/undo.backup.dirstate + [24] r4/\.hg/undo\.backup\.dirstate (re) 2 r4/.hg/undo.bookmarks 2 r4/.hg/undo.branch 2 r4/.hg/undo.desc - 2 r4/.hg/undo.dirstate + [24] r4/\.hg/undo\.dirstate (re) 2 r4/d1/data1 2 r4/d1/f2 2 r4/f1 @@ -272,11 +272,11 @@ Update back to revision 11 in r4 should 2 r4/.hg/store/undo.backup.phaseroots 2 r4/.hg/store/undo.backupfiles 2 r4/.hg/store/undo.phaseroots - 2 r4/.hg/undo.backup.dirstate + [24] r4/\.hg/undo\.backup\.dirstate (re) 2 r4/.hg/undo.bookmarks 2 r4/.hg/undo.branch 2 r4/.hg/undo.desc - 2 r4/.hg/undo.dirstate + [24] r4/\.hg/undo\.dirstate (re) 2 r4/d1/data1 2 r4/d1/f2 1 r4/f1