[PATCH 08 of 12] context: use labels instead of hardcoding tags and bookmarks

Pierre-Yves David pierre-yves.david at ens-lyon.org
Thu Aug 21 14:30:44 CDT 2014



On 08/21/2014 11:23 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 1396309619 18000
>>> #      Mon Mar 31 18:46:59 2014 -0500
>>> # Node ID 5e3722e0076cc2a3c92758ff762e2916ce05e569
>>> # Parent  80fe2f84bc7a0d327aac7456eec8e996a3d3488d
>>> context: use labels instead of hardcoding tags and bookmarks
>>>
>>> diff --git a/mercurial/context.py b/mercurial/context.py
>>> --- a/mercurial/context.py
>>> +++ b/mercurial/context.py
>>> @@ -424,18 +424,15 @@ class changectx(basectx):
>>>                    self._rev = repo.changelog.rev(self._node)
>>>                    return
>>>                except (TypeError, LookupError):
>>>                    pass
>>>
>>> -        if changeid in repo._bookmarks:
>>> -            self._node = repo._bookmarks[changeid]
>>> -            self._rev = repo.changelog.rev(self._node)
>>> -            return
>>> -        if changeid in repo._tagscache.tags:
>>> -            self._node = repo._tagscache.tags[changeid]
>>> -            self._rev = repo.changelog.rev(self._node)
>>> -            return
>>> +        for namespace, labels in repo.alllabels().iteritems():
>>> +            if changeid in labels:
>>> +                self._node = labels[changeid]
>>> +                self._rev = repo.changelog.rev(self._node)
>>> +                return
>>
>> This means that resolution is done in namespace alphabetical order this
>> should probably be highlighted sooner and louder
>
> Ah, I think I see what you mean now. Previously, we preferred bookmarks,
> then tags. Now it's alphabetical. Yes, that should be, at the very
> least, documented in a comment.

at the very list yes. I think there is a whole help topic on specifying 
revision. It should probably be updated too.

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list