Mercurial > hg
diff mercurial/debugcommands.py @ 47674:ff97e793ed36
dirstate-v2: Introduce a docket file
.hg/dirstate now only contains some metadata to point to a separate data file
named .hg/dirstate.{}.d with a random hexadecimal identifier. For now every
update creates a new data file and removes the old one, but later we’ll
(usually) append to an existing file.
Separating into two files allows doing the "write to a temporary file then
atomically rename into destination" dance with only a small docket file,
without always rewriting a lot of data.
Differential Revision: https://phab.mercurial-scm.org/D11088
author | Simon Sapin <simon.sapin@octobus.net> |
---|---|
date | Thu, 08 Jul 2021 12:18:21 +0200 |
parents | 85ce6ed51b9c |
children | 096ee2e260a3 |
line wrap: on
line diff
--- a/mercurial/debugcommands.py Thu Jul 15 17:24:09 2021 +0200 +++ b/mercurial/debugcommands.py Thu Jul 08 12:18:21 2021 +0200 @@ -7,6 +7,7 @@ from __future__ import absolute_import +import binascii import codecs import collections import contextlib @@ -987,6 +988,24 @@ @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: + hash_offset = 16 # Four 32-bit integers before this field + hash_len = 20 # 160 bits for SHA-1 + data_filename = repo.dirstate._map.docket.data_filename() + with repo.vfs(data_filename) as f: + hash_bytes = f.read(hash_offset + hash_len)[-hash_len:] + ui.write(binascii.hexlify(hash_bytes) + b'\n') + + +@command( b'debugdiscovery', [ (b'', b'old', None, _(b'use old-style discovery')),