tags: reverse and simplify head-walking
authorMatt Mackall <mpm@selenic.com>
Thu, 18 Jun 2009 20:50:35 -0500
changeset 8852 a81652fcaf6b
parent 8851 52cf210d0046
child 8853 e28b7939d430
tags: reverse and simplify head-walking
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