[PATCH 1 of 2] localrepo: ignore tags to unknown nodes (issue2750)

Idan Kamara idankk86 at gmail.com
Tue Apr 5 15:14:47 CDT 2011


# HG changeset patch
# User Idan Kamara <idankk86 at gmail.com>
# Date 1301946670 -10800
# Node ID 8336b69f5fdd194c14ced20251a0b79fa12306a2
# Parent  4d2f177e1a9d9be7fce7518a191c21e748078ea1
localrepo: ignore tags to unknown nodes (issue2750)

diff -r 4d2f177e1a9d -r 8336b69f5fdd mercurial/localrepo.py
--- a/mercurial/localrepo.py	Mon Apr 04 18:05:14 2011 +0300
+++ 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()])


More information about the Mercurial-devel mailing list