[PATCH] blackbox: also log alias expansions

Augie Fackler raf at durin42.com
Thu Aug 25 00:50:47 EDT 2016


> On Aug 24, 2016, at 10:01 AM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> 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().

I think it’s worse than that: we don’t look for a repo to associate with the command until after shell aliases are already executed.

> 
>> --- 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?

Done.

> 
>> +        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().

Oh nice, I didn’t know that.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20160825/10afb8ed/attachment.sig>


More information about the Mercurial-devel mailing list