D4832: debugcommands: add a debugindexstats command
This revision was automatically updated to reflect the committed changes. Closed by commit rHGd71e0ba34d9b: debugcommands: add a debugindexstats command (authored by martinvonz, committed by ). REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4832?vs=11577&id=11578 REVISION DETAIL https://phab.mercurial-scm.org/D4832 AFFECTED FILES mercurial/debugcommands.py tests/test-completion.t tests/test-debugcommands.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 @@ debugindexdump 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 debugknowntest whether node ids are known to a repo debuglocksshow or modify state of locks diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -177,6 +177,16 @@ debugdelta chain basic output #if reporevlogstore + $ hg debugindexstats + node trie capacity: 4 + node trie count: 2 + node trie depth: 1 + node trie last rev scanned: -1 + node trie lookups: 4 + node trie misses: 1 + node trie splits: 1 + revs in memory: 3 + $ hg debugdeltachain -m rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio 0 11 -1base 44 43 44 1.0232644 00.0 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,13 @@ ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) ui.write("}\n") +@command('debugindexstats', []) +def debugindexstats(ui, repo): +"""show stats related to the changelog index""" +repo.changelog.shortest(nullid, 1) +for k, v in sorted(repo.changelog.index.stats().items()): +ui.write('%s: %s\n' % (k, v)) + @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True) def debuginstall(ui, **opts): '''test Mercurial installation To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
martinvonz updated this revision to Diff 11577. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4832?vs=11576&id=11577 REVISION DETAIL https://phab.mercurial-scm.org/D4832 AFFECTED FILES mercurial/debugcommands.py tests/test-completion.t tests/test-debugcommands.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 @@ debugindexdump 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 debugknowntest whether node ids are known to a repo debuglocksshow or modify state of locks diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -177,6 +177,16 @@ debugdelta chain basic output #if reporevlogstore + $ hg debugindexstats + node trie capacity: 4 + node trie count: 2 + node trie depth: 1 + node trie last rev scanned: -1 + node trie lookups: 4 + node trie misses: 1 + node trie splits: 1 + revs in memory: 3 + $ hg debugdeltachain -m rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio 0 11 -1base 44 43 44 1.0232644 00.0 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,13 @@ ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) ui.write("}\n") +@command('debugindexstats', []) +def debugindexstats(ui, repo): +"""show stats related to the changelog index""" +repo.changelog.shortest(nullid, 1) +for k, v in sorted(repo.changelog.index.stats().items()): +ui.write('%s: %s\n' % (k, v)) + @command('debuginstall', [] + cmdutil.formatteropts, '', norepo=True) def debuginstall(ui, **opts): '''test Mercurial installation To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
martinvonz planned changes to this revision. martinvonz added a comment. Actually, that also shows that we can easily make it easier to read. I'll put each item on a separate line. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4832 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
martinvonz added a comment. In https://phab.mercurial-scm.org/D4832#73119, @pulkit wrote: > Can we please add a simple test for the new command? Good point. It was trivial to add and it really helps explain what the command does, so I should just done it. REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4832 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
martinvonz updated this revision to Diff 11576. REPOSITORY rHG Mercurial CHANGES SINCE LAST UPDATE https://phab.mercurial-scm.org/D4832?vs=11544&id=11576 REVISION DETAIL https://phab.mercurial-scm.org/D4832 AFFECTED FILES mercurial/debugcommands.py tests/test-completion.t tests/test-debugcommands.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 @@ debugindexdump 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 debugknowntest whether node ids are known to a repo debuglocksshow or modify state of locks diff --git a/tests/test-debugcommands.t b/tests/test-debugcommands.t --- a/tests/test-debugcommands.t +++ b/tests/test-debugcommands.t @@ -177,6 +177,9 @@ debugdelta chain basic output #if reporevlogstore + $ hg debugindexstats + {'node trie capacity': 4, 'node trie lookups': 4, 'node trie last rev scanned': -1, 'node trie count': 2, 'revs in memory': 3, 'node trie depth': 1, 'node trie splits': 1, 'node trie misses': 1} + $ hg debugdeltachain -m rev chain# chainlen prev delta sizerawsize chainsize ratio lindist extradist extraratio 0 11 -1base 44 43 44 1.0232644 00.0 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") +@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: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
pulkit added a comment. Can we please add a simple test for the new command? REPOSITORY rHG Mercurial REVISION DETAIL https://phab.mercurial-scm.org/D4832 To: martinvonz, #hg-reviewers Cc: pulkit, mercurial-devel ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
D4832: debugcommands: add a debugindexstats command
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 @@ debugindexdump 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 debugknowntest whether node ids are known to a repo debuglocksshow 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") +@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 ___ Mercurial-devel mailing list Mercurial-devel@mercurial-scm.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel