[Request] [+- ] D11863: filemerge: remove `premerge` argument from `_makebackup()`
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Mon Dec 6 20:36:08 UTC 2021
martinvonz created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.
REVISION SUMMARY
We now always pass `True`, so there's no need to pass it.
REPOSITORY
rHG Mercurial
BRANCH
default
REVISION DETAIL
https://phab.mercurial-scm.org/D11863
AFFECTED FILES
mercurial/filemerge.py
CHANGE DETAILS
diff --git a/mercurial/filemerge.py b/mercurial/filemerge.py
--- a/mercurial/filemerge.py
+++ b/mercurial/filemerge.py
@@ -924,7 +924,7 @@
fcd.write(back.data(), fcd.flags())
-def _makebackup(repo, ui, wctx, fcd, premerge):
+def _makebackup(repo, ui, wctx, fcd):
"""Makes and returns a filectx-like object for ``fcd``'s backup file.
In addition to preserving the user's pre-existing modifications to `fcd`
@@ -932,8 +932,8 @@
merge changed anything, and determine what line endings the new file should
have.
- Backups only need to be written once (right before the premerge) since their
- content doesn't change afterwards.
+ Backups only need to be written once since their content doesn't change
+ afterwards.
"""
if fcd.isabsent():
return None
@@ -950,20 +950,18 @@
# merging in-memory, we must redirect the backup to the memory context
# so we don't disturb the working directory.
relpath = back[len(repo.wvfs.base) + 1 :]
- if premerge:
- wctx[relpath].write(fcd.data(), fcd.flags())
+ wctx[relpath].write(fcd.data(), fcd.flags())
return wctx[relpath]
else:
- if premerge:
- # Otherwise, write to wherever path the user specified the backups
- # should go. We still need to switch based on whether the source is
- # in-memory so we can use the fast path of ``util.copy`` if both are
- # on disk.
- if isinstance(fcd, context.overlayworkingfilectx):
- util.writefile(back, fcd.data())
- else:
- a = _workingpath(repo, fcd)
- util.copyfile(a, back)
+ # Otherwise, write to wherever path the user specified the backups
+ # should go. We still need to switch based on whether the source is
+ # in-memory so we can use the fast path of ``util.copy`` if both are
+ # on disk.
+ if isinstance(fcd, context.overlayworkingfilectx):
+ util.writefile(back, fcd.data())
+ else:
+ a = _workingpath(repo, fcd)
+ util.copyfile(a, back)
# A arbitraryfilectx is returned, so we can run the same functions on
# the backup context regardless of where it lives.
return context.arbitraryfilectx(back, repo=repo)
@@ -1121,7 +1119,7 @@
ui.warn(onfailure % fduipath)
return True, 1, False
- back = _makebackup(repo, ui, wctx, fcd, True)
+ back = _makebackup(repo, ui, wctx, fcd)
files = (None, None, None, back)
r = 1
try:
To: martinvonz, #hg-reviewers
Cc: mercurial-patches, mercurial-devel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20211206/dd0f31ba/attachment.html>
More information about the Mercurial-patches
mailing list