diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py --- a/mercurial/debugcommands.py +++ b/mercurial/debugcommands.py @@ -859,6 +859,38 @@ def debugfileset(ui, repo, expr, **opts) 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 --git a/tests/test-completion.t b/tests/test-completion.t --- a/tests/test-completion.t +++ b/tests/test-completion.t @@ -87,6 +87,7 @@ Show debug commands if there are no othe debugdiscovery debugextensions debugfileset + debugformat debugfsinfo debuggetbundle debugignore @@ -264,6 +265,7 @@ Show all commands + options debugdiscovery: old, nonheads, rev, ssh, remotecmd, insecure debugextensions: template debugfileset: rev + debugformat: template debugfsinfo: debuggetbundle: head, common, type debugignore: diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -922,6 +922,7 @@ Test list of internal help commands 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 --git a/tests/test-upgrade-repo.t b/tests/test-upgrade-repo.t --- a/tests/test-upgrade-repo.t +++ b/tests/test-upgrade-repo.t @@ -54,6 +54,12 @@ An upgrade of a repository created with $ 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 @@ Various sub-optimal detections work > 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: