##// 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 41 from .utils import (
42 42 procutil,
43 stringutil,
43 44 )
44 45
45 46
@@ -402,6 +403,14 b' def _underlyingfctxifabsent(filectx):'
402 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 414 def _premerge(repo, local, other, base, toolconf, backup):
406 415 tool, toolpath, binary, symlink, scriptfn = toolconf
407 416 if symlink or local.fctx.isabsent() or other.fctx.isabsent():
@@ -429,6 +438,10 b' def _premerge(repo, local, other, base, '
429 438 mode = b'mergediff'
430 439 elif premerge == b'keep-merge3':
431 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 445 r = simplemerge.simplemerge(
433 446 ui, local, base, other, quiet=True, mode=mode
434 447 )
@@ -470,6 +483,12 b' def _merge(repo, local, other, base, mod'
470 483 of merge, unless mode equals 'union' which suppresses the markers."""
471 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 492 r = simplemerge.simplemerge(ui, local, base, other, mode=mode)
474 493 return True, r, False
475 494
General Comments 0
You need to be logged in to leave comments. Login now