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.
Alphare | |
marmoute |
hg-reviewers |
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.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/debugcommands.py (3 lines) | |||
M | tests/test-tags.t (4 lines) |
ui.write(node2str(node)) | ui.write(node2str(node)) | ||||
ui.write(b'\n') | ui.write(b'\n') | ||||
@command(b'debugtagscache', []) | @command(b'debugtagscache', []) | ||||
def debugtagscache(ui, repo): | def debugtagscache(ui, repo): | ||||
"""display the contents of .hg/cache/hgtagsfnodes1""" | """display the contents of .hg/cache/hgtagsfnodes1""" | ||||
cache = tagsmod.hgtagsfnodescache(repo.unfiltered()) | cache = tagsmod.hgtagsfnodescache(repo.unfiltered()) | ||||
flog = repo.file(b'.hgtags') | |||||
for r in repo: | for r in repo: | ||||
node = repo[r].node() | node = repo[r].node() | ||||
tagsnode = cache.getfnode(node, computemissing=False) | tagsnode = cache.getfnode(node, computemissing=False) | ||||
if tagsnode: | if tagsnode: | ||||
tagsnodedisplay = hex(tagsnode) | tagsnodedisplay = hex(tagsnode) | ||||
if not flog.hasnode(tagsnode): | |||||
tagsnodedisplay += b' (unknown node)' | |||||
elif tagsnode is None: | elif tagsnode is None: | ||||
tagsnodedisplay = b'missing' | tagsnodedisplay = b'missing' | ||||
else: | else: | ||||
tagsnodedisplay = b'invalid' | tagsnodedisplay = b'invalid' | ||||
ui.write(b'%d %s %s\n' % (r, hex(node), tagsnodedisplay)) | ui.write(b'%d %s %s\n' % (r, hex(node), tagsnodedisplay)) | ||||
0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.| | 0040: 78 ee 5a 2d ad bc 94 3d 6f a4 50 21 7d 3b 71 8c |x.Z-...=o.P!};q.| | ||||
0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..| | 0050: 96 4e f3 7b 89 e5 50 eb da fd 57 89 e7 6c e1 b0 |.N.{..P...W..l..| | ||||
0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(| | 0060: 0c 19 2d 7d 0c 04 f2 a8 af 31 de 17 fa b7 42 28 |..-}.....1....B(| | ||||
0070: 78 ee 5a 2d ad bc 94 3d 8d bf e6 0e 0c 04 f2 a8 |x.Z-...=........| | 0070: 78 ee 5a 2d ad bc 94 3d 8d bf e6 0e 0c 04 f2 a8 |x.Z-...=........| | ||||
0080: de ad de 17 fa b7 42 28 78 ee 5a 2d ad bc 94 3d |......B(x.Z-...=| | 0080: de ad de 17 fa b7 42 28 78 ee 5a 2d ad bc 94 3d |......B(x.Z-...=| | ||||
$ hg debugtagscache | tail -2 | $ hg debugtagscache | tail -2 | ||||
4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d | 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d | ||||
5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8deadde17fab7422878ee5a2dadbc943d | 5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8deadde17fab7422878ee5a2dadbc943d (unknown node) | ||||
$ rm -f .hg/cache/tags2-visible | $ rm -f .hg/cache/tags2-visible | ||||
$ hg debugtagscache | tail -2 | $ hg debugtagscache | tail -2 | ||||
4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d | 4 0c192d7d5e6b78a714de54a2e9627952a877e25a 0c04f2a8af31de17fab7422878ee5a2dadbc943d | ||||
5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8deadde17fab7422878ee5a2dadbc943d | 5 8dbfe60eff306a54259cfe007db9e330e7ecf866 0c04f2a8deadde17fab7422878ee5a2dadbc943d (unknown node) | ||||
$ hg tags | $ hg tags | ||||
abort: data/.hgtags.i@0c04f2a8deadde17fab7422878ee5a2dadbc943d: no match found | abort: data/.hgtags.i@0c04f2a8deadde17fab7422878ee5a2dadbc943d: no match found | ||||
[50] | [50] | ||||
BUG: Unless this file is restored, the `hg tags` in the next unix-permissions | BUG: Unless this file is restored, the `hg tags` in the next unix-permissions | ||||
conditional will fail: "abort: data/.hgtags.i@0c04f2a8dead: no match found" | conditional will fail: "abort: data/.hgtags.i@0c04f2a8dead: no match found" | ||||