[PATCH 7 of 7] tags: extract filenode filtering in it own function
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Tue Mar 28 07:53:29 EDT 2017
On 03/28/2017 12:18 PM, Ryan McElroy wrote:
> On 3/28/17 7:17 AM, Pierre-Yves David wrote:
[…]
>> diff --git a/mercurial/tags.py b/mercurial/tags.py
>> --- a/mercurial/tags.py
>> +++ b/mercurial/tags.py
>> @@ -95,17 +95,10 @@ def findglobaltags(ui, repo):
>> _updatetags(cachetags, alltags)
>> return alltags
>> - seen = set() # set of fnode
>> - fnodes = []
>> for head in reversed(heads): # oldest to newest
>> assert head in repo.changelog.nodemap, \
>> "tag cache returned bogus head %s" % short(head)
> Unrelated musing: why is this an assert? Who cares if the tags cache was
> corrupted somehow? We should be more robust here. (Doesn't affect your
> series as this is unchanged).
Actually, if the tag cache is used we won't reach that point. This get
used if the cache in invalid and we compute by hand. I don't think the
assert is really need, I just preserved it from Greg this is must have
been useful to catch error while editing the code.
>> -
>> - fnode = tagfnode.get(head)
>> - if fnode and fnode not in seen:
>> - seen.add(fnode)
>> - fnodes.append(fnode)
>> -
>> + fnodes = _filterfnodes(tagfnode, reversed(heads))
>> alltags = _tagsfromfnodes(ui, repo, fnodes)
>> # and update the cache (if necessary)
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list