comparison mercurial/debugcommands.py @ 46655: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
comparison
equal deleted inserted replaced
46654:9ea6b75b4a95 46655:e4e971abb6a3
3863 3863
3864 @command(b'debugtagscache', []) 3864 @command(b'debugtagscache', [])
3865 def debugtagscache(ui, repo): 3865 def debugtagscache(ui, repo):
3866 """display the contents of .hg/cache/hgtagsfnodes1""" 3866 """display the contents of .hg/cache/hgtagsfnodes1"""
3867 cache = tagsmod.hgtagsfnodescache(repo.unfiltered()) 3867 cache = tagsmod.hgtagsfnodescache(repo.unfiltered())
3868 flog = repo.file(b'.hgtags')
3868 for r in repo: 3869 for r in repo:
3869 node = repo[r].node() 3870 node = repo[r].node()
3870 tagsnode = cache.getfnode(node, computemissing=False) 3871 tagsnode = cache.getfnode(node, computemissing=False)
3871 if tagsnode: 3872 if tagsnode:
3872 tagsnodedisplay = hex(tagsnode) 3873 tagsnodedisplay = hex(tagsnode)
3874 if not flog.hasnode(tagsnode):
3875 tagsnodedisplay += b' (unknown node)'
3873 elif tagsnode is None: 3876 elif tagsnode is None:
3874 tagsnodedisplay = b'missing' 3877 tagsnodedisplay = b'missing'
3875 else: 3878 else:
3876 tagsnodedisplay = b'invalid' 3879 tagsnodedisplay = b'invalid'
3877 3880