##// END OF EJS Templates
filemerge: remove `premerge` argument from `_makebackup()`...
Martin von Zweigbergk -
r49262:0994125a default
parent child Browse files
Show More
@@ -924,7 +924,7 b' def _restorebackup(fcd, back):'
924 924 fcd.write(back.data(), fcd.flags())
925 925
926 926
927 def _makebackup(repo, ui, wctx, fcd, premerge):
927 def _makebackup(repo, ui, wctx, fcd):
928 928 """Makes and returns a filectx-like object for ``fcd``'s backup file.
929 929
930 930 In addition to preserving the user's pre-existing modifications to `fcd`
@@ -932,8 +932,8 b' def _makebackup(repo, ui, wctx, fcd, pre'
932 932 merge changed anything, and determine what line endings the new file should
933 933 have.
934 934
935 Backups only need to be written once (right before the premerge) since their
936 content doesn't change afterwards.
935 Backups only need to be written once since their content doesn't change
936 afterwards.
937 937 """
938 938 if fcd.isabsent():
939 939 return None
@@ -950,20 +950,18 b' def _makebackup(repo, ui, wctx, fcd, pre'
950 950 # merging in-memory, we must redirect the backup to the memory context
951 951 # so we don't disturb the working directory.
952 952 relpath = back[len(repo.wvfs.base) + 1 :]
953 if premerge:
954 wctx[relpath].write(fcd.data(), fcd.flags())
953 wctx[relpath].write(fcd.data(), fcd.flags())
955 954 return wctx[relpath]
956 955 else:
957 if premerge:
958 # Otherwise, write to wherever path the user specified the backups
959 # should go. We still need to switch based on whether the source is
960 # in-memory so we can use the fast path of ``util.copy`` if both are
961 # on disk.
962 if isinstance(fcd, context.overlayworkingfilectx):
963 util.writefile(back, fcd.data())
964 else:
965 a = _workingpath(repo, fcd)
966 util.copyfile(a, back)
956 # Otherwise, write to wherever path the user specified the backups
957 # should go. We still need to switch based on whether the source is
958 # in-memory so we can use the fast path of ``util.copy`` if both are
959 # on disk.
960 if isinstance(fcd, context.overlayworkingfilectx):
961 util.writefile(back, fcd.data())
962 else:
963 a = _workingpath(repo, fcd)
964 util.copyfile(a, back)
967 965 # A arbitraryfilectx is returned, so we can run the same functions on
968 966 # the backup context regardless of where it lives.
969 967 return context.arbitraryfilectx(back, repo=repo)
@@ -1121,7 +1119,7 b' def filemerge(repo, wctx, mynode, orig, '
1121 1119 ui.warn(onfailure % fduipath)
1122 1120 return True, 1, False
1123 1121
1124 back = _makebackup(repo, ui, wctx, fcd, True)
1122 back = _makebackup(repo, ui, wctx, fcd)
1125 1123 files = (None, None, None, back)
1126 1124 r = 1
1127 1125 try:
General Comments 0
You need to be logged in to leave comments. Login now