[Commented On] D10853: copyfile: add a option callback for failed hardlinking
baymax (Baymax, Your Personal Patch-care Companion)
phabricator at mercurial-scm.org
Tue Jun 15 14:25:37 UTC 2021
baymax added a comment.
baymax updated this revision to Diff 28575.
✅ refresh by Heptapod after a successful CI run (🐙 💚)
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D10853?vs=28530&id=28575
BRANCH
default
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D10853/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D10853
AFFECTED FILES
mercurial/util.py
CHANGE DETAILS
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1910,7 +1910,13 @@
def copyfile(
- src, dest, hardlink=False, copystat=False, checkambig=False, nb_bytes=None
+ src,
+ dest,
+ hardlink=False,
+ copystat=False,
+ checkambig=False,
+ nb_bytes=None,
+ no_hardlink_cb=None,
):
"""copy a file, preserving mode and optionally other stat info like
atime/mtime
@@ -1937,6 +1943,8 @@
except OSError:
fstype = None
if fstype not in _hardlinkfswhitelist:
+ if no_hardlink_cb is not None:
+ no_hardlink_cb()
hardlink = False
if hardlink:
try:
@@ -1945,8 +1953,10 @@
m = "the `nb_bytes` argument is incompatible with `hardlink`"
raise error.ProgrammingError(m)
return
- except (IOError, OSError):
- pass # fall back to normal copy
+ except (IOError, OSError) as exc:
+ if exc.errno != errno.EEXIST and no_hardlink_cb is not None:
+ no_hardlink_cb()
+ # fall back to normal copy
if os.path.islink(src):
os.symlink(os.readlink(src), dest)
# copytime is ignored for symlinks, but in general copytime isn't needed
To: marmoute, #hg-reviewers, pulkit
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210615/abeaef0a/attachment-0002.html>
More information about the Mercurial-patches
mailing list