mercurial/tags.py
changeset 21832 4b93e19cd6e6
parent 21814 5125856a28cf
parent 21823 925d1bb9a971
child 21892 89cdebc31cda
--- a/mercurial/tags.py	Tue Jul 01 19:54:48 2014 -0500
+++ b/mercurial/tags.py	Wed Jul 02 00:01:13 2014 -0500
@@ -73,6 +73,15 @@
     filetags = _readtags(
         ui, repo, data.splitlines(), "localtags",
         recode=encoding.fromlocal)
+
+    # remove tags pointing to invalid nodes
+    cl = repo.changelog
+    for t in filetags.keys():
+        try:
+            cl.rev(filetags[t][0])
+        except (LookupError, ValueError):
+            del filetags[t]
+
     _updatetags(filetags, "local", alltags, tagtypes)
 
 def _readtags(ui, repo, lines, fn, recode=None):