D4820: logtoprocess: sends the canonical command name to the subprocess
Yuya Nishihara
yuya at tcha.org
Wed Oct 3 09:01:41 EDT 2018
> +def extsetup():
> + # this is to get the canonical name of the command: "commit", not "ci"
> + def wrapdispatch(orig, *args, **kwargs):
> + encoding.environ.pop("LTP_COMMAND", None)
> + return orig(*args, **kwargs)
> +
> + def wrapruncommand(orig, *args, **kwargs):
> + encoding.environ["LTP_COMMAND"] = args[2]
> + return orig(*args, **kwargs)
> +
> + extensions.wrapfunction(dispatch,'dispatch',wrapdispatch)
> + extensions.wrapfunction(dispatch,'runcommand',wrapruncommand)
It's scary to update the environment variables globally and pass
`LTP_COMMAND` in to any child processes.
Can you add a proper way to teach the command name to the logtoprocess
extension, by `ui.log()` for example?
Also, the word `LTP` isn't used anywhere. It'll need a better name, and
should be documented.
More information about the Mercurial-devel
mailing list