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