[PATCH 4 of 6] filemerge: show warning if chosen tool has no binary files capability

Yuya Nishihara yuya at tcha.org
Thu Aug 16 05:49:00 EDT 2018


On Thu, 16 Aug 2018 03:35:36 +0900, FUJIWARA Katsunori wrote:
> # HG changeset patch
> # User FUJIWARA Katsunori <foozy at lares.dti.ne.jp>
> # Date 1534339478 -32400
> #      Wed Aug 15 22:24:38 2018 +0900
> # Node ID 48c9d0cb2afe7692324e1fa7872bc577db6496af
> # Parent  1d16378efeb91e435d520b081a7a34b78d7fa7e2
> # Available At https://bitbucket.org/foozy/mercurial-wip
> #              hg pull https://bitbucket.org/foozy/mercurial-wip -r 48c9d0cb2afe
> # EXP-Topic filemerge-refactor
> filemerge: show warning if chosen tool has no binary files capability

> --- a/mercurial/filemerge.py
> +++ b/mercurial/filemerge.py
> @@ -195,6 +195,12 @@ def _picktool(repo, ui, path, binary, sy
>      for pat, tool in ui.configitems("merge-patterns"):
>          mf = match.match(repo.root, '', [pat])
>          if mf(path) and check(tool, pat, symlink, False, changedelete):
> +            if binary and not hascapability(tool, "binary", strict=True):
> +                ui.warn(_("warning: check merge-patterns configurations,"
> +                          " if %r for binary file %r is unintentional\n"
> +                          "(see 'hg help merge-tools'"
> +                          " for binary files capability)\n")
> +                        % (tool, path))

Inserted pycompat.bytestr(...) to drop b'' on Python 3.

> +  $ hg update -q -C 0
> +  $ python <<EOF
> +  > with open('b', 'wb') as fp:
> +  >     fp.write(b'\x00\x01\x02\x03')
> +  > EOF

Nit: this can be inline python.


More information about the Mercurial-devel mailing list