changeset 8853:e28b7939d430

tags: generate contexts directly
author Matt Mackall <mpm@selenic.com>
date Thu, 18 Jun 2009 23:04:54 -0500
parents a81652fcaf6b
children 980f5b7c5fb6
files mercurial/localrepo.py
diffstat 1 files changed, 9 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/localrepo.py	Thu Jun 18 20:50:35 2009 -0500
+++ b/mercurial/localrepo.py	Thu Jun 18 23:04:54 2009 -0500
@@ -290,25 +290,26 @@
                 globaltags[k] = an, ah
                 tagtypes[k] = tagtype
 
-        def tagnodes():
+        def tagctxs():
             seen = set()
+            f = None
             ret = []
             for node in self.heads():
-                c = self[node]
                 try:
-                    fnode = c.filenode('.hgtags')
+                    fnode = self[node].filenode('.hgtags')
                 except error.LookupError:
                     continue
                 if fnode not in seen:
-                    ret.append((node, fnode))
                     seen.add(fnode)
+                    if not f:
+                        f = self.filectx('.hgtags', fileid=fnode)
+                    else:
+                        f = f.filectx(fnode)
+                    ret.append(f)
             return reversed(ret)
 
         # read the tags file from each head, ending with the tip
-        f = None
-        for node, fnode in tagnodes():
-            f = (f and f.filectx(fnode) or
-                 self.filectx('.hgtags', fileid=fnode))
+        for f in tagctxs():
             readtags(f.data().splitlines(), f, "global")
 
         try: