[PATCH] dispatch: strip command line options like config file options

Tony Tung tonytung at instagram.com
Thu Feb 11 08:06:40 UTC 2016


> On Feb 10, 2016, at 11:49 PM, Yuya Nishihara <yuya at tcha.org> wrote:
> 
> On Mon, 8 Feb 2016 15:36:15 -0800, Tony Tung wrote:
>> # HG changeset patch
>> # User Tony Tung <ttung at fb.com>
>> # Date 1454974530 28800
>> #      Mon Feb 08 15:35:30 2016 -0800
>> # Node ID 97240c9addb84f73752dad57e6531dfea30f3f0d
>> # Parent  01a5143cd25f285f8c745a92986cd7186bb32c90
>> dispatch: strip command line options like config file options.
>> 
>> Currently, whitespace in command line --config options are considered
>> significant while whitespace in config files are not considered
>> significant.  This diff strips the leading and trailing whitespace from
>> command line config options.
>> 
>> diff --git a/mercurial/dispatch.py b/mercurial/dispatch.py
>> --- a/mercurial/dispatch.py
>> +++ b/mercurial/dispatch.py
>> @@ -609,7 +609,8 @@
>> 
>>     for cfg in config:
>>         try:
>> -            name, value = cfg.split('=', 1)
>> +            name, value = [cfgelem.strip()
>> +                           for cfgelem in cfg.split('=', 1)]
> 
> I think that's up to parser whether white space is significant or not.

The parser definitely has a say into the significance of the outer whitespaces, but it has no visibility into the inner whitespaces, i.e., the spaces surrounding the =.

Thanks,
Tony


More information about the Mercurial-devel mailing list