diff mercurial/debugcommands.py @ 46694:e4e971abb6a3

debugtagscache: verify that filenode is correct Previous patch from Matt demonstrates that `debugtagscache` does not warn about filenode being unknown which can be caused by a corrupted cache. We start by showing that it's an unknown node. Differential Revision: https://phab.mercurial-scm.org/D10015
author Pulkit Goyal <7895pulkit@gmail.com>
date Mon, 15 Feb 2021 17:08:18 +0530
parents 9306a16ca964
children a4c19a162615
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Dec 24 12:23:46 2020 -0500
+++ b/mercurial/debugcommands.py	Mon Feb 15 17:08:18 2021 +0530
@@ -3865,11 +3865,14 @@
 def debugtagscache(ui, repo):
     """display the contents of .hg/cache/hgtagsfnodes1"""
     cache = tagsmod.hgtagsfnodescache(repo.unfiltered())
+    flog = repo.file(b'.hgtags')
     for r in repo:
         node = repo[r].node()
         tagsnode = cache.getfnode(node, computemissing=False)
         if tagsnode:
             tagsnodedisplay = hex(tagsnode)
+            if not flog.hasnode(tagsnode):
+                tagsnodedisplay += b' (unknown node)'
         elif tagsnode is None:
             tagsnodedisplay = b'missing'
         else: