changeset 44336:d8b53385b1bc

tags: add a debug command to display .hg/cache/hgtagsfnodes1 Differential Revision: https://phab.mercurial-scm.org/D8093
author Valentin Gatien-Baron <vgatien-baron@janestreet.com>
date Fri, 07 Feb 2020 13:54:09 -0500
parents 9f8eddd2723f
children 89d44cfcdeeb
files mercurial/debugcommands.py tests/test-completion.t tests/test-help.t tests/test-tags.t
diffstat 4 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Sat Feb 08 10:22:47 2020 -0500
+++ b/mercurial/debugcommands.py	Fri Feb 07 13:54:09 2020 -0500
@@ -76,6 +76,7 @@
     sshpeer,
     sslutil,
     streamclone,
+    tags as tagsmod,
     templater,
     treediscovery,
     upgrade,
@@ -3428,6 +3429,15 @@
                     ui.write(node2str(node))
             ui.write(b'\n')
 
+@command(b'debugtagscache', [])
+def debugtagscache(ui, repo):
+    """display the contents of .hg/cache/hgtagsfnodes1"""
+    cache = tagsmod.hgtagsfnodescache(repo.unfiltered())
+    for r in repo:
+        node = repo[r].node()
+        tagsnode = cache.getfnode(node, computemissing=False)
+        tagsnodedisplay = hex(tagsnode) if tagsnode else 'missing/invalid'
+        ui.write(b'%s %s %s\n' % (r, hex(node), tagsnodedisplay))
 
 @command(
     b'debugtemplate',
--- a/tests/test-completion.t	Sat Feb 08 10:22:47 2020 -0500
+++ b/tests/test-completion.t	Fri Feb 07 13:54:09 2020 -0500
@@ -128,6 +128,7 @@
   debugssl
   debugsub
   debugsuccessorssets
+  debugtagscache
   debugtemplate
   debuguigetpass
   debuguiprompt
@@ -310,6 +311,7 @@
   debugssl: 
   debugsub: rev
   debugsuccessorssets: closest
+  debugtagscache: 
   debugtemplate: rev, define
   debuguigetpass: prompt
   debuguiprompt: prompt
--- a/tests/test-help.t	Sat Feb 08 10:22:47 2020 -0500
+++ b/tests/test-help.t	Fri Feb 07 13:54:09 2020 -0500
@@ -1055,6 +1055,8 @@
    debugsub      (no help text available)
    debugsuccessorssets
                  show set of successors for revision
+   debugtagscache
+                 display the contents of .hg/cache/hgtagsfnodes1
    debugtemplate
                  parse and apply a template
    debuguigetpass
--- a/tests/test-tags.t	Sat Feb 08 10:22:47 2020 -0500
+++ b/tests/test-tags.t	Fri Feb 07 13:54:09 2020 -0500
@@ -103,6 +103,9 @@
   0000: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff |................|
   0010: ff ff ff ff ff ff ff ff b9 15 46 36 26 b7 b4 a7 |..........F6&...|
   0020: 73 e0 9e e3 c5 2f 51 0e 19 e0 5e 1f f9 66 d8 59 |s..../Q...^..f.Y|
+  $ hg debugtagscache
+  0 acb14030fe0a21b60322c440ad2d20cf7685a376 missing/invalid
+  1 b9154636be938d3d431e75a7c906504a079bfe07 26b7b4a773e09ee3c52f510e19e05e1ff966d859
 
 Repeat with cold tag cache: