changeset 8852:a81652fcaf6b

tags: reverse and simplify head-walking
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Jun 2009 20:50:35 -0500
parents 52cf210d0046
children e28b7939d430
files mercurial/localrepo.py
diffstat 1 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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