localrepo: ignore tags to unknown nodes (issue2750)
authorIdan Kamara <idankk86@gmail.com>
Mon, 04 Apr 2011 22:51:10 +0300
changeset 13892 31d15f761631
parent 13891 1bd9f3a6a0d0
child 13893 1aea86673dee
localrepo: ignore tags to unknown nodes (issue2750)
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Tue Apr 05 19:48:44 2011 +0200
+++ b/mercurial/localrepo.py	Mon Apr 04 22:51:10 2011 +0300
@@ -362,7 +362,12 @@
         tags = {}
         for (name, (node, hist)) in alltags.iteritems():
             if node != nullid:
-                tags[encoding.tolocal(name)] = node
+                try:
+                    # ignore tags to unknown nodes
+                    self.changelog.lookup(node)
+                    tags[encoding.tolocal(name)] = node
+                except error.LookupError:
+                    pass
         tags['tip'] = self.changelog.tip()
         tagtypes = dict([(encoding.tolocal(name), value)
                          for (name, value) in tagtypes.iteritems()])