diff --git a/mercurial/simplemerge.py b/mercurial/simplemerge.py --- a/mercurial/simplemerge.py +++ b/mercurial/simplemerge.py @@ -465,22 +465,28 @@ def __init__(self, fctx, label=None, label_detail=None): self.fctx = fctx self.label = label + self._text = None # If the "detail" part is set, then that is rendered after the label and # separated by a ':'. The label is padded to make the ':' aligned among # all merge inputs. self.label_detail = label_detail - def _verifytext(self, ui, opts): + def text(self): + if self._text is None: + # Merges were always run in the working copy before, which means + # they used decoded data, if the user defined any repository + # filters. + # + # Maintain that behavior today for BC, though perhaps in the future + # it'd be worth considering whether merging encoded data (what the + # repository usually sees) might be more useful. + self._text = self.fctx.decodeddata() + return self._text + + def verifytext(self, ui, **opts): """verifies that text is non-binary (unless opts[text] is passed, then we just warn)""" - # Merges were always run in the working copy before, which means - # they used decoded data, if the user defined any repository - # filters. - # - # Maintain that behavior today for BC, though perhaps in the future - # it'd be worth considering whether merging encoded data (what the - # repository usually sees) might be more useful. - text = self.fctx.decodeddata() + text = self.text() if stringutil.binary(text): msg = _(b"%s looks like a binary file.") % self.fctx.path() if not opts.get('quiet'): @@ -497,9 +503,9 @@ """ try: - localtext = local._verifytext(ui, opts) - basetext = base._verifytext(ui, opts) - othertext = other._verifytext(ui, opts) + localtext = local.verifytext(ui, **opts) + basetext = base.verifytext(ui, **opts) + othertext = other.verifytext(ui, **opts) except error.Abort: return True