[PATCH 1 of 1] keyword: use os.sep in default keywordmaps

Patrick Mézard pmezard at gmail.com
Mon Feb 8 16:13:21 CST 2010


Le 08/02/10 23:00, Christian Ebert a écrit :
> * Patrick Mézard on Monday, February 08, 2010 at 21:50:57 +0100
>> Le 08/02/10 15:13, Christian Ebert a écrit :
>>> # HG changeset patch
>>> # User Kevin O. Grover <kevin at kevingrover.net>
>>> # Date 1265638286 -3600
>>> # Node ID eafc7976c686b9161e9336d5db20e61f33de47c7
>>> # Parent  935ef1836b2f6172c1b003fa751a5b327a9bae7e
>>> keyword: use os.sep in default keywordmaps
>>>
>>> diff --git a/hgext/keyword.py b/hgext/keyword.py
>>> --- a/hgext/keyword.py
>>> +++ b/hgext/keyword.py
>>> @@ -82,7 +82,7 @@
>>> from mercurial.lock import release
>>> from mercurial.node import nullid
>>> from mercurial.i18n import _
>>> -import re, shutil, tempfile
>>> +import os, re, shutil, tempfile
>>>
>>> commands.optionalrepo += ' kwdemo'
>>>
>>> @@ -115,9 +115,10 @@
>>>         '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,
>>>         'Id': '{file|basename},v {node|short} {date|utcdate} {author|user}',
>>> -        'Header': '{root}/{file},v {node|short} {date|utcdate} {author|user}',
>>> +        'Header': '{root}%s{file},v {node|short} {date|utcdate} {author|user}'
>>> +                  % os.sep,
>>>     }
>>>
>>>     def __init__(self, ui, repo):
>>
>> Is that how it works in CVS world or how we would like it
>> worked? I don't have the time to learn how to use CVS keywords
>> under windows but the only web page with substitution samples
>> shows paths with slashes in them, not backslashes:
>>
>>    http://www.mobilefish.com/developer/cvsnt/cvsnt_quickguide_cvskeywords.html
> 
> That's the question I wanted to ask by submitting this patch ;-)
> 
> The next question:
> 
> How does the output of hg log --template='{file}\n' look on
> windows? From Kevin's proposal I assumed it uses backslashes as
> separator (I don't have/know windows). If not, the patch is
> indeed superfluous, if yes, I don't know what to do yet if I want
> to keep a flexible, template based keywordmaps configuration.

It displays normalized file names, with a slash.

--
Patrick Mézard


More information about the Mercurial-devel mailing list