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