> +def _describemerge(ui, repo, env, toolpath, args):
> +    template = ui.config('ui', 'pre-merge-tool-output-template')
> +    if not template:
> +        return
> +
> +    # Remove HG_ prefix from entries in `env` and lowercase them
> +    def sanitizeenv(k):
> +        if k.startswith('HG_'):
> +            return k[3:].lower()
> +        return k

Nit: `HG_FILE` should be called as `path` per
https://www.mercurial-scm.org/wiki/GenericTemplatingPlan#Dictionary

We might want to structure these variables as `base.node|short` instead of
`base_node` for example, but that would require more work.

> +    data = {sanitizeenv(k): v for k, v in env.items()}
> +    data['toolpath'] = toolpath
> +    data['toolargs'] = args
> +
> +    # TODO: make all of this something that can be specified on a per-tool 
> basis
> +    template = templater.unquotestring(template)
> +
> +    fm = ui.formatter("extmerge", pycompat.byteskwargs({'template': 
> template}))
                                     ^^^^^^^^^^^^^^^^^^^^
Unnecessary. It's bytes dict.

> +    fm.data(repo=repo, **data)
                          ^^^^^^
Here pycompat.strkwargs() would be needed.

And use `fm.context(repo=repo)` or `fm.context(fctx=fcd)` since `repo` is
unprintable.

> +coreconfigitem('ui', 'pre-merge-tool-output-template',
> +    default=None,
> +)

Can you update the help/config.txt as well?
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to