##// END OF EJS Templates
simplemerge: let filemerge check for binary inputs...
Martin von Zweigbergk -
r49597:d9af7c1f default
parent child Browse files
Show More
@@ -40,6 +40,7 b' from . import ('
40
40
41 from .utils import (
41 from .utils import (
42 procutil,
42 procutil,
43 stringutil,
43 )
44 )
44
45
45
46
@@ -402,6 +403,14 b' def _underlyingfctxifabsent(filectx):'
402 return filectx
403 return filectx
403
404
404
405
406 def _verifytext(input, ui):
407 """verifies that text is non-binary"""
408 if stringutil.binary(input.text()):
409 msg = _(b"%s looks like a binary file.") % input.fctx.path()
410 ui.warn(_(b'warning: %s\n') % msg)
411 raise error.Abort(msg)
412
413
405 def _premerge(repo, local, other, base, toolconf, backup):
414 def _premerge(repo, local, other, base, toolconf, backup):
406 tool, toolpath, binary, symlink, scriptfn = toolconf
415 tool, toolpath, binary, symlink, scriptfn = toolconf
407 if symlink or local.fctx.isabsent() or other.fctx.isabsent():
416 if symlink or local.fctx.isabsent() or other.fctx.isabsent():
@@ -429,6 +438,10 b' def _premerge(repo, local, other, base, '
429 mode = b'mergediff'
438 mode = b'mergediff'
430 elif premerge == b'keep-merge3':
439 elif premerge == b'keep-merge3':
431 mode = b'merge3'
440 mode = b'merge3'
441 if any(
442 stringutil.binary(input.text()) for input in (local, base, other)
443 ):
444 return 1 # continue merging
432 r = simplemerge.simplemerge(
445 r = simplemerge.simplemerge(
433 ui, local, base, other, quiet=True, mode=mode
446 ui, local, base, other, quiet=True, mode=mode
434 )
447 )
@@ -470,6 +483,12 b' def _merge(repo, local, other, base, mod'
470 of merge, unless mode equals 'union' which suppresses the markers."""
483 of merge, unless mode equals 'union' which suppresses the markers."""
471 ui = repo.ui
484 ui = repo.ui
472
485
486 try:
487 _verifytext(local, ui)
488 _verifytext(base, ui)
489 _verifytext(other, ui)
490 except error.Abort:
491 return True, True, False
473 r = simplemerge.simplemerge(ui, local, base, other, mode=mode)
492 r = simplemerge.simplemerge(ui, local, base, other, mode=mode)
474 return True, r, False
493 return True, r, False
475
494
General Comments 0
You need to be logged in to leave comments. Login now