[PATCH] blackbox: also log alias expansions

Yuya Nishihara yuya at tcha.org
Wed Aug 24 10:01:16 EDT 2016


On Tue, 23 Aug 2016 16:53:47 -0400, Augie Fackler wrote:
> # HG changeset patch
> # User Augie Fackler <augie at google.com>
> # Date 1471984808 14400
> #      Tue Aug 23 16:40:08 2016 -0400
> # Node ID b3c025f053ec7573bea30e8b9482d7e2c57caf7b
> # Parent  92ac2baaea86dbba8565c359206fb97d39ec6e63
> blackbox: also log alias expansions
> 
> This should be extremely useful for helping users debug without having
> to see their complete configuration.
> 
> Shell aliases appear to not be logged at all, which I find confusing,
> but I haven't taken the time to debug in any detail.

Shell aliases are handled prior to parsing command options in _dispatch().

> --- a/mercurial/dispatch.py
> +++ b/mercurial/dispatch.py
> @@ -889,6 +889,9 @@ def _dispatch(req):
>  
>      msg = ' '.join(' ' in a and repr(a) or a for a in fullargs)
>      ui.log("command", '%s\n', msg)
> +    if isinstance(func, cmdalias):

Can we move this to cmdalias.__call__() where exactly the same debug message
exists?

> +        ui.log('commandalias',  "alias '%s' expands to '%s %s'\n" % (
> +            func.name, func.cmdname, ' '.join(func.givenargs)))

%s shouldn't be expanded by the caller, which is done by ui.log().


More information about the Mercurial-devel mailing list