RFC: external tool to answer merge prompts (and others?)
Thomas Arendsen Hein
thomas at intevation.de
Tue Jul 24 09:32:10 CDT 2012
Hi!
In some situations the user will be prompted for decisions during
merge, e.g.:
"local changed %s which remote deleted
use (c)hanged version or (d)elete?"
To be able to automate giving non-default answers or use an external
GUI tool when using frontends, a mechanism similar to the current
[merge-tools] section could be created.
Configuration could look like this:
[merge-prompts]
internal:prompt.priority=0
internal:prompt.interactive=False
internal:prompt.label=remote-changed-local-deleted
tool1.priority=10
tool1.interactive=False
tool1.label=local-changed-remote-deleted
tool2.priority=20
tool2.executable = /path/to/tool2
#tool2.regkey = Software\FooSoftware\PromptThingy
tool2.args=$msg $choices $default $base $local $other $file
tool2.gui=True
tool2.interactive=True
tool2.label=local-changed-remote-deleted, remote-changed-local-deleted
With the first block (internal:prompt) you could automatically give
the default answer (or internal:prompt.choice=1 to choose the second
option).
tool1 would be an automatic script that reads environment variables
to make a decision: $HG_FILE, $HG_OTHER_NODE, $HG_MY_NODE,
$HG_BASE_NODE (same as currently with [merge-tools])
tool2 would open an interactive GUI to let the user decide what to
do, using arguments instead of environment variables.
TortoiseHG already does something like this by overriding
ui.promptchoice, but e.g. MercurialEclipse always uses the default
answer.
I limited this to the ui.promptchoice calls done during merge, so
this matches the existing [merge-tools] configuration and to make it
cooperate with existing TortoiseHG code.
Of course this mechanism could be implemented for any calls to
ui.prompt or ui.promptchoice, in which case the label check for
merges could be something like:
tool1.label="merge.local-changed-remote-deleted"
or for a more generic merge-prompt tool:
tool1.label="merge.*"
Thoughts?
Regards,
Thomas
--
thomas at intevation.de - http://intevation.de/~thomas/ - OpenPGP key: 0x5816791A
Intevation GmbH, Neuer Graben 17, 49074 Osnabrueck - AG Osnabrueck, HR B 18998
Geschaeftsfuehrer: Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner
More information about the Mercurial-devel
mailing list