# HG changeset patch # User Matt Mackall # Date 1245376235 18000 # Node ID a81652fcaf6b9bcf2a5ca524250a49ef7bf5fa63 # Parent 52cf210d00465d17cc34f773b66d2d54837a4c0e tags: reverse and simplify head-walking diff -r 52cf210d0046 -r a81652fcaf6b mercurial/localrepo.py --- a/mercurial/localrepo.py Thu Jun 18 20:50:33 2009 -0500 +++ b/mercurial/localrepo.py Thu Jun 18 20:50:35 2009 -0500 @@ -291,19 +291,18 @@ tagtypes[k] = tagtype def tagnodes(): - last = {} + seen = set() ret = [] - for node in reversed(self.heads()): + for node in self.heads(): c = self[node] try: fnode = c.filenode('.hgtags') except error.LookupError: continue - ret.append((node, fnode)) - if fnode in last: - ret[last[fnode]] = None - last[fnode] = len(ret) - 1 - return [item for item in ret if item] + if fnode not in seen: + ret.append((node, fnode)) + seen.add(fnode) + return reversed(ret) # read the tags file from each head, ending with the tip f = None