This is useful information that we don't easily have access to currently,
unless you speak fluent xxd.
This replaces debugdirstateignorepatternshash, which I'll remove in the next
changeset.
marmoute |
hg-reviewers |
This is useful information that we don't easily have access to currently,
unless you speak fluent xxd.
This replaces debugdirstateignorepatternshash, which I'll remove in the next
changeset.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
✅ refresh by Heptapod after a successful CI run (🐙 💚)
⚠ This patch is intended for stable ⚠
Path | Packages | |||
---|---|---|---|---|
M | mercurial/debugcommands.py (34 lines) | |||
M | tests/test-completion.t (2 lines) | |||
M | tests/test-hgignore.t (8 lines) |
bundle2, | bundle2, | ||||
bundlerepo, | bundlerepo, | ||||
changegroup, | changegroup, | ||||
cmdutil, | cmdutil, | ||||
color, | color, | ||||
context, | context, | ||||
copies, | copies, | ||||
dagparser, | dagparser, | ||||
dirstateutils, | |||||
encoding, | encoding, | ||||
error, | error, | ||||
exchange, | exchange, | ||||
extensions, | extensions, | ||||
filemerge, | filemerge, | ||||
filesetlang, | filesetlang, | ||||
formatter, | formatter, | ||||
hg, | hg, | ||||
b'nodates', | b'nodates', | ||||
None, | None, | ||||
_(b'do not display the saved mtime (DEPRECATED)'), | _(b'do not display the saved mtime (DEPRECATED)'), | ||||
), | ), | ||||
(b'', b'dates', True, _(b'display the saved mtime')), | (b'', b'dates', True, _(b'display the saved mtime')), | ||||
(b'', b'datesort', None, _(b'sort by saved mtime')), | (b'', b'datesort', None, _(b'sort by saved mtime')), | ||||
( | ( | ||||
b'', | b'', | ||||
b'docket', | |||||
False, | |||||
_(b'display the docket (metadata file) instead'), | |||||
), | |||||
( | |||||
b'', | |||||
b'all', | b'all', | ||||
False, | False, | ||||
_(b'display dirstate-v2 tree nodes that would not exist in v1'), | _(b'display dirstate-v2 tree nodes that would not exist in v1'), | ||||
), | ), | ||||
], | ], | ||||
_(b'[OPTION]...'), | _(b'[OPTION]...'), | ||||
) | ) | ||||
def debugstate(ui, repo, **opts): | def debugstate(ui, repo, **opts): | ||||
"""show the contents of the current dirstate""" | """show the contents of the current dirstate""" | ||||
if opts.get("docket"): | |||||
if not repo.dirstate._use_dirstate_v2: | |||||
raise error.Abort(_(b'dirstate v1 does not have a docket')) | |||||
docket = repo.dirstate._map.docket | |||||
( | |||||
start_offset, | |||||
root_nodes, | |||||
nodes_with_entry, | |||||
nodes_with_copy, | |||||
unused_bytes, | |||||
_unused, | |||||
ignore_pattern, | |||||
) = dirstateutils.v2.TREE_METADATA.unpack(docket.tree_metadata) | |||||
ui.write(_(b"size of dirstate data: %d\n") % docket.data_size) | |||||
ui.write(_(b"data file uuid: %s\n") % docket.uuid) | |||||
ui.write(_(b"start offset of root nodes: %d\n") % start_offset) | |||||
ui.write(_(b"number of root nodes: %d\n") % root_nodes) | |||||
ui.write(_(b"nodes with entries: %d\n") % nodes_with_entry) | |||||
ui.write(_(b"nodes with copies: %d\n") % nodes_with_copy) | |||||
ui.write(_(b"number of unused bytes: %d\n") % unused_bytes) | |||||
ui.write( | |||||
_(b"ignore pattern hash: %s\n") % binascii.hexlify(ignore_pattern) | |||||
) | |||||
return | |||||
nodates = not opts['dates'] | nodates = not opts['dates'] | ||||
if opts.get('nodates') is not None: | if opts.get('nodates') is not None: | ||||
nodates = True | nodates = True | ||||
datesort = opts.get('datesort') | datesort = opts.get('datesort') | ||||
if datesort: | if datesort: | ||||
def keyfunc(entry): | def keyfunc(entry): |
debugcommands: | debugcommands: | ||||
debugcomplete: options | debugcomplete: options | ||||
debugcreatestreamclonebundle: | debugcreatestreamclonebundle: | ||||
debugdag: tags, branches, dots, spaces | debugdag: tags, branches, dots, spaces | ||||
debugdata: changelog, manifest, dir | debugdata: changelog, manifest, dir | ||||
debugdate: extended | debugdate: extended | ||||
debugdeltachain: changelog, manifest, dir, template | debugdeltachain: changelog, manifest, dir, template | ||||
debugdirstateignorepatternshash: | debugdirstateignorepatternshash: | ||||
debugdirstate: nodates, dates, datesort, all | debugdirstate: nodates, dates, datesort, docket, all | ||||
debugdiscovery: old, nonheads, rev, seed, local-as-revs, remote-as-revs, ssh, remotecmd, insecure, template | debugdiscovery: old, nonheads, rev, seed, local-as-revs, remote-as-revs, ssh, remotecmd, insecure, template | ||||
debugdownload: output | debugdownload: output | ||||
debugextensions: template | debugextensions: template | ||||
debugfileset: rev, all-files, show-matcher, show-stage | debugfileset: rev, all-files, show-matcher, show-stage | ||||
debugformat: template | debugformat: template | ||||
debugfsinfo: | debugfsinfo: | ||||
debuggetbundle: head, common, type | debuggetbundle: head, common, type | ||||
debugignore: | debugignore: |
#if dirstate-v2 rust | #if dirstate-v2 rust | ||||
Check the hash of ignore patterns written in the dirstate | Check the hash of ignore patterns written in the dirstate | ||||
This is an optimization that is only relevant when using the Rust extensions | This is an optimization that is only relevant when using the Rust extensions | ||||
$ hg status > /dev/null | $ hg status > /dev/null | ||||
$ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | ||||
sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | ||||
$ hg debugdirstateignorepatternshash | $ hg debugstate --docket | grep ignore | ||||
6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | ignore pattern hash: 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff | ||||
$ echo rel > .hg/testhgignorerel | $ echo rel > .hg/testhgignorerel | ||||
$ hg status > /dev/null | $ hg status > /dev/null | ||||
$ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | $ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1 | ||||
sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e | sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e | ||||
$ hg debugdirstateignorepatternshash | $ hg debugstate --docket | grep ignore | ||||
dea19cc7119213f24b6b582a4bae7b0cb063e34e | ignore pattern hash: dea19cc7119213f24b6b582a4bae7b0cb063e34e | ||||
#endif | #endif |