localrepo: ignore tags to unknown nodes (issue2750) stable
authorIdan Kamara <idankk86@gmail.com>
Mon, 04 Apr 2011 22:51:10 +0300
branchstable
changeset 14499 a281981e2033
parent 14498 4d958d1bb072
child 14500 e880433a2e00
localrepo: ignore tags to unknown nodes (issue2750)
mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Mar 14 23:50:28 2011 +0100
+++ b/mercurial/localrepo.py	Mon Apr 04 22:51:10 2011 +0300
@@ -361,7 +361,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()])