# HG changeset patch # User Boris Feld # Date 1512659986 -3600 # Node ID c3e4f196b6e07e627f2d624b0b3fb19c4742865c # Parent 0181f99819d2bcde338304caf37972b1b630a6b6 debugformat: add a 'debugformat' command The command displays basic data about all format variants registered for repo upgrades. This gives a quick way to peek into a repository format. The 'fm.write()' calls are very independent because more data will be added in later changeset. Having more separate call make the later patch clearer. diff -r 0181f99819d2 -r c3e4f196b6e0 mercurial/debugcommands.py --- a/mercurial/debugcommands.py Thu Dec 07 15:55:59 2017 +0100 +++ b/mercurial/debugcommands.py Thu Dec 07 16:19:46 2017 +0100 @@ -859,6 +859,38 @@ for f in ctx.getfileset(expr): ui.write("%s\n" % f) +@command('debugformat', + [] + cmdutil.formatteropts, + _('')) +def debugformat(ui, repo, **opts): + """display format information about the current repository""" + maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant) + maxvariantlength = max(len('format-variant'), maxvariantlength) + + def makeformatname(name): + return '%s:' + (' ' * (maxvariantlength - len(name))) + + def formatvalue(value): + if value: + return 'yes' + else: + return 'no' + + fm = ui.formatter('debugformat', opts) + fm.plain('format-variant') + fm.plain(' ' * (maxvariantlength - len('format-variant'))) + fm.plain(' repo') + fm.plain('\n') + fm.startitem() + for fv in upgrade.allformatvariant: + repovalue = fv.fromrepo(repo) + + fm.write('name', makeformatname(fv.name), fv.name, + label='formatvariant.name') + fm.write('repo', ' %3s', formatvalue(repovalue), + label='formatvariant.repo') + fm.plain('\n') + @command('debugfsinfo', [], _('[PATH]'), norepo=True) def debugfsinfo(ui, path="."): """show information detected about current filesystem""" diff -r 0181f99819d2 -r c3e4f196b6e0 tests/test-completion.t --- a/tests/test-completion.t Thu Dec 07 15:55:59 2017 +0100 +++ b/tests/test-completion.t Thu Dec 07 16:19:46 2017 +0100 @@ -87,6 +87,7 @@ debugdiscovery debugextensions debugfileset + debugformat debugfsinfo debuggetbundle debugignore @@ -264,6 +265,7 @@ debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure debugextensions: template debugfileset: rev + debugformat: template debugfsinfo: debuggetbundle: head, common, type debugignore: diff -r 0181f99819d2 -r c3e4f196b6e0 tests/test-help.t --- a/tests/test-help.t Thu Dec 07 15:55:59 2017 +0100 +++ b/tests/test-help.t Thu Dec 07 16:19:46 2017 +0100 @@ -922,6 +922,7 @@ debugextensions show information about active extensions debugfileset parse and apply a fileset specification + debugformat display format information about the current repository debugfsinfo show information detected about current filesystem debuggetbundle retrieves a bundle from a repo diff -r 0181f99819d2 -r c3e4f196b6e0 tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t Thu Dec 07 15:55:59 2017 +0100 +++ b/tests/test-upgrade-repo.t Thu Dec 07 16:19:46 2017 +0100 @@ -54,6 +54,12 @@ $ hg init empty $ cd empty + $ hg debugformat + format-variant repo + fncache: yes + dotencode: yes + generaldelta: yes + plain-cl-delta: yes $ hg debugupgraderepo (no feature deficiencies found in existing repository) performing an upgrade with "--run" will make the following changes: @@ -101,6 +107,12 @@ > store > EOF + $ hg debugformat + format-variant repo + fncache: no + dotencode: no + generaldelta: no + plain-cl-delta: yes $ hg debugupgraderepo repository lacks features recommended by current config options: