D4832: debugcommands: add a debugindexstats command

martinvonz (Martin von Zweigbergk) phabricator at mercurial-scm.org
Tue Oct 2 05:50:40 UTC 2018


martinvonz created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  Someone went through the trouble of recording these stats, so let's
  make them accessible.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D4832

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-completion.t
  tests/test-help.t

CHANGE DETAILS

diff --git a/tests/test-help.t b/tests/test-help.t
--- a/tests/test-help.t
+++ b/tests/test-help.t
@@ -942,6 +942,8 @@
    debugindex    dump index data for a storage primitive
    debugindexdot
                  dump an index DAG as a graphviz dot file
+   debugindexstats
+                 show stats related to the changelog index
    debuginstall  test Mercurial installation
    debugknown    test whether node ids are known to a repo
    debuglocks    show or modify state of locks
diff --git a/tests/test-completion.t b/tests/test-completion.t
--- a/tests/test-completion.t
+++ b/tests/test-completion.t
@@ -94,6 +94,7 @@
   debugignore
   debugindex
   debugindexdot
+  debugindexstats
   debuginstall
   debugknown
   debuglabelcomplete
@@ -282,6 +283,7 @@
   debugignore: 
   debugindex: changelog, manifest, dir, template
   debugindexdot: changelog, manifest, dir
+  debugindexstats: 
   debuginstall: template
   debugknown: 
   debuglabelcomplete: 
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -1164,6 +1164,12 @@
             ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i))
     ui.write("}\n")
 
+ at command('debugindexstats', [])
+def debugindexstats(ui, repo):
+    """show stats related to the changelog index"""
+    repo.changelog.shortest(nullid, 1)
+    ui.write('%s\n' % repo.changelog.index.stats())
+
 @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True)
 def debuginstall(ui, **opts):
     '''test Mercurial installation



To: martinvonz, #hg-reviewers
Cc: mercurial-devel


More information about the Mercurial-devel mailing list