[PATCH 11 of 12] templatekw: add a keyword to list all labels

Sean Farley sean.michael.farley at gmail.com
Thu Aug 21 16:01:30 CDT 2014


Pierre-Yves David writes:

> On 08/21/2014 11:26 AM, Sean Farley wrote:
>>
>> Pierre-Yves David writes:
>>
>>> On 08/18/2014 02:18 PM, Sean Farley wrote:
>>>> # HG changeset patch
>>>> # User Sean Farley <sean.michael.farley at gmail.com>
>>>> # Date 1408394525 18000
>>>> #      Mon Aug 18 15:42:05 2014 -0500
>>>> # Node ID e1ab9da20be237323a1340efa16b58b03525596f
>>>> # Parent  f49b99874b05d0a902f8ed02201d9e57fc81c684
>>>> templatekw: add a keyword to list all labels
>>>>
>>>> diff --git a/mercurial/templatekw.py b/mercurial/templatekw.py
>>>> --- a/mercurial/templatekw.py
>>>> +++ b/mercurial/templatekw.py
>>>> @@ -374,10 +374,16 @@ def showsubrepos(**args):
>>>>
>>>>    def showtags(**args):
>>>>        """:tags: List of strings. Any tags associated with the changeset."""
>>>>        return showlist('tag', args['ctx'].tags(), **args)
>>>>
>>>> +def showlabels(**args):
>>>> +    """:tags: List of strings. Any labels in the namespace `namespace`
>>>> +    associated with the changeset."""
>>>
>>> did you forget to update the inital :tags: ?
>>>
>>> Also you docstring hint that this takes an argument while the
>>> implementation does not.
>>
>> Oops, yep, I changed that but forgot to update the docstring.
>>
>>>> +    labels = sorted(l[0] for l in args['repo'].nodelabels(args['ctx'].node()))
>>>
>>> isn't l[0] the namespace?
>
> isn't it ?

I seem to have reversed the label with namespace in the sorted
list. This will be refactored by using util.sortdict.

>>>
>>>> +    return showlist('label', labels, **args)
>>>> +
>>>
>>> You don't perform any deduplication. should we?
>>
>> Good point. I would say 'yes'. Or we could do something else
>> (e.g. prefix the name with its namespace)?
>
> meh, we should at least keep a simple version around by default (withotu 
> namespace) just deduplicating should be fine.

Sure, will do.


More information about the Mercurial-devel mailing list