mercurial/simplemerge.py
changeset 48754 d9602f0df4f3
parent 48751 59c6724ddccb
child 48755 6ae3c97a0919
--- a/mercurial/simplemerge.py	Thu Feb 10 15:27:58 2022 -0800
+++ b/mercurial/simplemerge.py	Thu Feb 10 15:48:01 2022 -0800
@@ -272,16 +272,12 @@
         return sl
 
 
-def _verifytext(text, path, ui, quiet=False, allow_binary=False):
+def _verifytext(input):
     """verifies that text is non-binary (unless opts[text] is passed,
     then we just warn)"""
-    if stringutil.binary(text):
-        msg = _(b"%s looks like a binary file.") % path
-        if not quiet:
-            ui.warn(_(b'warning: %s\n') % msg)
-        if not allow_binary:
-            raise error.Abort(msg)
-    return text
+    if stringutil.binary(input.text()):
+        msg = _(b"%s looks like a binary file.") % input.fctx.path()
+        raise error.Abort(msg)
 
 
 def _format_labels(*inputs):
@@ -511,23 +507,12 @@
     The merged result is written into `localctx`.
     """
 
-    def readctx(input):
-        return _verifytext(
-            input.text(),
-            input.fctx.path(),
-            ui,
-            quiet=quiet,
-            allow_binary=allow_binary,
-        )
+    if not allow_binary:
+        _verifytext(local)
+        _verifytext(base)
+        _verifytext(other)
 
-    try:
-        localtext = readctx(local)
-        basetext = readctx(base)
-        othertext = readctx(other)
-    except error.Abort:
-        return True
-
-    m3 = Merge3Text(basetext, localtext, othertext)
+    m3 = Merge3Text(base.text(), local.text(), other.text())
     conflicts = False
     if mode == b'union':
         lines = _resolve(m3, (1, 2))