[PATCH 1 of 2] keyword: fix: Use os.sep for Source and Header keywords

Mads Kiilerich mads at kiilerich.com
Sun Jan 31 07:04:38 CST 2010


David Soria Parra wrote, On 01/31/2010 01:19 PM:
> On 2010-01-30, Kevin Grover<kevin at kevingrover.net>  wrote:
>    
>> @@ -115,9 +115,9 @@
>>           'RCSfile': '{file|basename},v',
>>           'RCSFile': '{file|basename},v', # kept for backwards compatibility
>>                                           # with hg-keyword
>> -        'Source': '{root}/{file},v',
>> +        'Source': '{root}%s{file},v' % (os.sep, ),
>>      
> why don't you use '{root}%s{file,v' % os.sep, instead of (os.sep,) ?
>    

FWIW I prefer the latter to avoid the (mis)feature that % can take 
either a single value or a list of values (which itself is a value too).

By specifying a singleton tuple it is unambiguous what is meant. It 
could make a difference if os.sep happend to be a list and we expected 
the string representation of it.

It could also make a difference when converting to python 3 - I don't know.

/Mads


More information about the Mercurial-devel mailing list