##// END OF EJS Templates
filemerge: rename backup variables from `back` to `backup`...
Martin von Zweigbergk -
r49334:da38519c default
parent child Browse files
Show More
@@ -293,9 +293,9 b' def _eoltype(data):'
293 293 return None # unknown
294 294
295 295
296 def _matcheol(file, back):
296 def _matcheol(file, backup):
297 297 """Convert EOL markers in a file to match origfile"""
298 tostyle = _eoltype(back.data()) # No repo.wread filters?
298 tostyle = _eoltype(backup.data()) # No repo.wread filters?
299 299 if tostyle:
300 300 data = util.readfile(file)
301 301 style = _eoltype(data)
@@ -403,7 +403,7 b' def _premerge(repo, fcd, fco, fca, toolc'
403 403 tool, toolpath, binary, symlink, scriptfn = toolconf
404 404 if symlink or fcd.isabsent() or fco.isabsent():
405 405 return 1
406 unused, unused, unused, back = files
406 unused, unused, unused, backup = files
407 407
408 408 ui = repo.ui
409 409
@@ -438,7 +438,7 b' def _premerge(repo, fcd, fco, fca, toolc'
438 438 return 0
439 439 if premerge not in validkeep:
440 440 # restore from backup and try again
441 _restorebackup(fcd, back)
441 _restorebackup(fcd, backup)
442 442 return 1 # continue merging
443 443
444 444
@@ -755,12 +755,12 b' def _xmerge(repo, mynode, orig, fcd, fco'
755 755 % (tool, uipathfn(fcd.path()))
756 756 )
757 757 return False, 1, None
758 unused, unused, unused, back = files
758 unused, unused, unused, backup = files
759 759 localpath = _workingpath(repo, fcd)
760 760 args = _toolstr(repo.ui, tool, b"args")
761 761
762 762 with _maketempfiles(
763 repo, fco, fca, repo.wvfs.join(back.path()), b"$output" in args
763 repo, fco, fca, repo.wvfs.join(backup.path()), b"$output" in args
764 764 ) as temppaths:
765 765 basepath, otherpath, localoutputpath = temppaths
766 766 outpath = b""
@@ -918,10 +918,10 b' def partextras(labels):'
918 918 }
919 919
920 920
921 def _restorebackup(fcd, back):
921 def _restorebackup(fcd, backup):
922 922 # TODO: Add a workingfilectx.write(otherfilectx) path so we can use
923 923 # util.copy here instead.
924 fcd.write(back.data(), fcd.flags())
924 fcd.write(backup.data(), fcd.flags())
925 925
926 926
927 927 def _makebackup(repo, ui, wctx, fcd):
@@ -941,15 +941,15 b' def _makebackup(repo, ui, wctx, fcd):'
941 941 # merge -> filemerge). (I suspect the fileset import is the weakest link)
942 942 from . import context
943 943
944 back = scmutil.backuppath(ui, repo, fcd.path())
945 inworkingdir = back.startswith(repo.wvfs.base) and not back.startswith(
944 backup = scmutil.backuppath(ui, repo, fcd.path())
945 inworkingdir = backup.startswith(repo.wvfs.base) and not backup.startswith(
946 946 repo.vfs.base
947 947 )
948 948 if isinstance(fcd, context.overlayworkingfilectx) and inworkingdir:
949 949 # If the backup file is to be in the working directory, and we're
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 relpath = back[len(repo.wvfs.base) + 1 :]
952 relpath = backup[len(repo.wvfs.base) + 1 :]
953 953 wctx[relpath].write(fcd.data(), fcd.flags())
954 954 return wctx[relpath]
955 955 else:
@@ -958,13 +958,13 b' def _makebackup(repo, ui, wctx, fcd):'
958 958 # in-memory so we can use the fast path of ``util.copy`` if both are
959 959 # on disk.
960 960 if isinstance(fcd, context.overlayworkingfilectx):
961 util.writefile(back, fcd.data())
961 util.writefile(backup, fcd.data())
962 962 else:
963 963 a = _workingpath(repo, fcd)
964 util.copyfile(a, back)
964 util.copyfile(a, backup)
965 965 # A arbitraryfilectx is returned, so we can run the same functions on
966 966 # the backup context regardless of where it lives.
967 return context.arbitraryfilectx(back, repo=repo)
967 return context.arbitraryfilectx(backup, repo=repo)
968 968
969 969
970 970 @contextlib.contextmanager
@@ -1118,8 +1118,8 b' def filemerge(repo, wctx, mynode, orig, '
1118 1118 ui.warn(onfailure % fduipath)
1119 1119 return True, 1, False
1120 1120
1121 back = _makebackup(repo, ui, wctx, fcd)
1122 files = (None, None, None, back)
1121 backup = _makebackup(repo, ui, wctx, fcd)
1122 files = (None, None, None, backup)
1123 1123 r = 1
1124 1124 try:
1125 1125 internalmarkerstyle = ui.config(b'ui', b'mergemarkers')
@@ -1188,8 +1188,8 b' def filemerge(repo, wctx, mynode, orig, '
1188 1188
1189 1189 return True, r, deleted
1190 1190 finally:
1191 if not r and back is not None:
1192 back.remove()
1191 if not r and backup is not None:
1192 backup.remove()
1193 1193
1194 1194
1195 1195 def _haltmerge():
@@ -1225,7 +1225,7 b' def hasconflictmarkers(data):'
1225 1225 def _check(repo, r, ui, tool, fcd, files):
1226 1226 fd = fcd.path()
1227 1227 uipathfn = scmutil.getuipathfn(repo)
1228 unused, unused, unused, back = files
1228 unused, unused, unused, backup = files
1229 1229
1230 1230 if not r and (
1231 1231 _toolbool(ui, tool, b"checkconflicts")
@@ -1252,7 +1252,7 b' def _check(repo, r, ui, tool, fcd, files'
1252 1252 or b'changed' in _toollist(ui, tool, b"check")
1253 1253 )
1254 1254 ):
1255 if back is not None and not fcd.cmp(back):
1255 if backup is not None and not fcd.cmp(backup):
1256 1256 if ui.promptchoice(
1257 1257 _(
1258 1258 b" output file %s appears unchanged\n"
@@ -1264,8 +1264,8 b' def _check(repo, r, ui, tool, fcd, files'
1264 1264 ):
1265 1265 r = 1
1266 1266
1267 if back is not None and _toolbool(ui, tool, b"fixeol"):
1268 _matcheol(_workingpath(repo, fcd), back)
1267 if backup is not None and _toolbool(ui, tool, b"fixeol"):
1268 _matcheol(_workingpath(repo, fcd), backup)
1269 1269
1270 1270 return r
1271 1271
General Comments 0
You need to be logged in to leave comments. Login now