D5094: merge-tools: when calling external merge tool, describe the resolve inputs
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Tue Oct 16 06:05:46 EDT 2018
yuja added a comment.
> +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?
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5094
To: spectral, #hg-reviewers
Cc: yuja, mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list