diff mercurial/localrepo.py @ 8916:3df8dbf706b0

merged with crew
author Martin Geisler <mg@lazybytes.net>
date Sun, 21 Jun 2009 19:06:57 +0200
parents 105343f9f744 5096a47d8aec
children e67e5b60e55f
line wrap: on
line diff
--- a/mercurial/localrepo.py	Sat Jun 20 18:58:34 2009 +0200
+++ b/mercurial/localrepo.py	Sun Jun 21 19:06:57 2009 +0200
@@ -262,7 +262,7 @@
                     warn(_("node '%s' is not well formed") % node)
                     continue
                 if bin_n not in self.changelog.nodemap:
-                    warn(_("tag '%s' refers to unknown node") % key)
+                    # silently ignore as pull -r might cause this
                     continue
 
                 h = []
@@ -290,11 +290,24 @@
                 globaltags[k] = an, ah
                 tagtypes[k] = tagtype
 
-        # read the tags file from each head, ending with the tip
+        seen = set()
         f = None
-        for rev, node, fnode in self._hgtagsnodes():
-            f = (f and f.filectx(fnode) or
-                 self.filectx('.hgtags', fileid=fnode))
+        ctxs = []
+        for node in self.heads():
+            try:
+                fnode = self[node].filenode('.hgtags')
+            except error.LookupError:
+                continue
+            if fnode not in seen:
+                seen.add(fnode)
+                if not f:
+                    f = self.filectx('.hgtags', fileid=fnode)
+                else:
+                    f = f.filectx(fnode)
+                ctxs.append(f)
+
+        # read the tags file from each head, ending with the tip
+        for f in reversed(ctxs):
             readtags(f.data().splitlines(), f, "global")
 
         try:
@@ -328,22 +341,6 @@
 
         return self._tagstypecache.get(tagname)
 
-    def _hgtagsnodes(self):
-        last = {}
-        ret = []
-        for node in reversed(self.heads()):
-            c = self[node]
-            rev = c.rev()
-            try:
-                fnode = c.filenode('.hgtags')
-            except error.LookupError:
-                continue
-            ret.append((rev, node, fnode))
-            if fnode in last:
-                ret[last[fnode]] = None
-            last[fnode] = len(ret) - 1
-        return [item for item in ret if item]
-
     def tagslist(self):
         '''return a list of tags ordered by revision'''
         l = []