[Updated] D12590: dirstate-v2: add flag to `debugstate` to print docket information
Alphare (Raphaël Gomès)
phabricator at mercurial-scm.org
Wed May 4 14:24:39 UTC 2022
Closed by commit rHGeaaf4f98c9f1: dirstate-v2: add flag to `debugstate` to print docket information (authored by Alphare).
This revision was automatically updated to reflect the committed changes.
This revision was not accepted when it landed; it landed in state "Needs Review".
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D12590?vs=33321&id=33339
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D12590/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D12590
AFFECTED FILES
mercurial/debugcommands.py
tests/test-completion.t
tests/test-hgignore.t
CHANGE DETAILS
diff --git a/tests/test-hgignore.t b/tests/test-hgignore.t
--- a/tests/test-hgignore.t
+++ b/tests/test-hgignore.t
@@ -418,14 +418,14 @@
$ hg status > /dev/null
$ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1
sha1=6e315b60f15fb5dfa02be00f3e2c8f923051f5ff
- $ hg debugdirstateignorepatternshash
- 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff
+ $ hg debugstate --docket | grep ignore
+ ignore pattern hash: 6e315b60f15fb5dfa02be00f3e2c8f923051f5ff
$ echo rel > .hg/testhgignorerel
$ hg status > /dev/null
$ cat .hg/testhgignore .hg/testhgignorerel .hgignore dir2/.hgignore dir1/.hgignore dir1/.hgignoretwo | $TESTDIR/f --sha1
sha1=dea19cc7119213f24b6b582a4bae7b0cb063e34e
- $ hg debugdirstateignorepatternshash
- dea19cc7119213f24b6b582a4bae7b0cb063e34e
+ $ hg debugstate --docket | grep ignore
+ ignore pattern hash: dea19cc7119213f24b6b582a4bae7b0cb063e34e
#endif
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -286,7 +286,7 @@
debugdate: extended
debugdeltachain: changelog, manifest, dir, template
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
debugdownload: output
debugextensions: template
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -47,6 +47,7 @@
context,
copies,
dagparser,
+ dirstateutils,
encoding,
error,
exchange,
@@ -940,6 +941,12 @@
(b'', b'datesort', None, _(b'sort by saved mtime')),
(
b'',
+ b'docket',
+ False,
+ _(b'display the docket (metadata file) instead'),
+ ),
+ (
+ b'',
b'all',
False,
_(b'display dirstate-v2 tree nodes that would not exist in v1'),
@@ -950,6 +957,33 @@
def debugstate(ui, repo, **opts):
"""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']
if opts.get('nodates') is not None:
nodates = True
To: Alphare, #hg-reviewers, marmoute
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mercurial-scm.org/pipermail/mercurial-patches/attachments/20220504/d3968935/attachment-0001.html>
More information about the Mercurial-patches
mailing list