--- a/mercurial/debugcommands.py Tue May 17 12:05:09 2022 +0100
+++ b/mercurial/debugcommands.py Mon May 16 23:12:49 2022 +0100
@@ -1017,6 +1017,22 @@
@command(
+ b'debugdirstateignorepatternshash',
+ [],
+ _(b''),
+)
+def debugdirstateignorepatternshash(ui, repo, **opts):
+ """show the hash of ignore patterns stored in dirstate if v2,
+ or nothing for dirstate-v2
+ """
+ if repo.dirstate._use_dirstate_v2:
+ docket = repo.dirstate._map.docket
+ hash_len = 20 # 160 bits for SHA-1
+ hash_bytes = docket.tree_metadata[-hash_len:]
+ ui.write(binascii.hexlify(hash_bytes) + b'\n')
+
+
+@command(
b'debugdiscovery',
[
(b'', b'old', None, _(b'use old-style discovery')),