[Updated] D12169: simplemerge: remove code for checking binary input now that callers do it
martinvonz (Martin von Zweigbergk)
phabricator at mercurial-scm.org
Tue Feb 15 12:56:24 UTC 2022
Closed by commit rHGd9602f0df4f3: simplemerge: remove code for checking binary input now that callers do it (authored by martinvonz).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12169?vs=32137&id=32192
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12169/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12169
AFFECTED FILES
mercurial/simplemerge.py
CHANGE DETAILS
diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py
--- a/mercurial/simplemerge.py
+++ b/mercurial/simplemerge.py
@@ -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))
To: martinvonz, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20220215/29ff151a/attachment-0002.html>
More information about the Mercurial-patches
mailing list