debugmergestate: make templated

Authored by martinvonz.


debugmergestate: make templated

Our IntelliJ team wants to be able to read the merge state in order to
help the user resolve merge conflicts. They had so far been reading
file contents from p1() and p2() and their merge base. That is not
ideal for several reasons (merge base is not necessarily the "graft
base", renames are not handled, commands like hg update -m is not
handled). It will get especially bad as of my D7827. This patch makes
the output s a templated. I haven't bothered to make it complete
(e.g. merge driver states are not handled), but it's probably good
enough as a start.

I've done a web search for "debugmergestate" and I can't find any
indication that any tools currently rely on its output. If it turns
out that we get bug reports for it once this is released, I won't
object to backing this patch out on the stable branch (and then
perhaps replace it by a separate command, or put it behind a new

Differential Revision: https://phab.mercurial-scm.org/D8113


martinvonzFeb 13 2020, 4:41 PM
Differential Revision
D8113: debugmergestate: make templated
rHG27a78ea30b48: copy: rename `wctx` to `ctx` since it will not necessarily be working copy