changeset 35337:cfb403b92f43

debugformat: add data about the config when verbose In verbose mode, the command also displays the current configuration choice for the variant and the global Mercurial default for it.
author Boris Feld <boris.feld@octobus.net>
date Thu, 07 Dec 2017 16:05:20 +0100
parents c3e4f196b6e0
children bd326f3e0e14
files mercurial/debugcommands.py tests/test-upgrade-repo.t
diffstat 2 files changed, 35 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/debugcommands.py	Thu Dec 07 16:19:46 2017 +0100
+++ b/mercurial/debugcommands.py	Thu Dec 07 16:05:20 2017 +0100
@@ -863,7 +863,10 @@
          [] + cmdutil.formatteropts,
         _(''))
 def debugformat(ui, repo, **opts):
-    """display format information about the current repository"""
+    """display format information about the current repository
+
+    Use --verbose to get extra information about current config value and
+    Mercurial default."""
     maxvariantlength = max(len(fv.name) for fv in upgrade.allformatvariant)
     maxvariantlength = max(len('format-variant'), maxvariantlength)
 
@@ -880,15 +883,22 @@
     fm.plain('format-variant')
     fm.plain(' ' * (maxvariantlength - len('format-variant')))
     fm.plain(' repo')
+    if ui.verbose:
+        fm.plain(' config default')
     fm.plain('\n')
     fm.startitem()
     for fv in upgrade.allformatvariant:
         repovalue = fv.fromrepo(repo)
+        configvalue = fv.fromconfig(repo)
 
         fm.write('name', makeformatname(fv.name), fv.name,
                  label='formatvariant.name')
         fm.write('repo', ' %3s', formatvalue(repovalue),
                  label='formatvariant.repo')
+        fm.condwrite(ui.verbose, 'config', ' %6s', formatvalue(configvalue),
+                     label='formatvariant.config')
+        fm.condwrite(ui.verbose, 'default', ' %7s', formatvalue(fv.default),
+                     label='formatvariant.default')
         fm.plain('\n')
 
 @command('debugfsinfo', [], _('[PATH]'), norepo=True)
--- a/tests/test-upgrade-repo.t	Thu Dec 07 16:19:46 2017 +0100
+++ b/tests/test-upgrade-repo.t	Thu Dec 07 16:05:20 2017 +0100
@@ -60,6 +60,18 @@
   dotencode:      yes
   generaldelta:   yes
   plain-cl-delta: yes
+  $ hg debugformat --verbose
+  format-variant repo config default
+  fncache:        yes    yes     yes
+  dotencode:      yes    yes     yes
+  generaldelta:   yes    yes     yes
+  plain-cl-delta: yes    yes     yes
+  $ hg debugformat --verbose --config format.usegfncache=no
+  format-variant repo config default
+  fncache:        yes    yes     yes
+  dotencode:      yes    yes     yes
+  generaldelta:   yes    yes     yes
+  plain-cl-delta: yes    yes     yes
   $ hg debugupgraderepo
   (no feature deficiencies found in existing repository)
   performing an upgrade with "--run" will make the following changes:
@@ -113,6 +125,18 @@
   dotencode:       no
   generaldelta:    no
   plain-cl-delta: yes
+  $ hg debugformat --verbose
+  format-variant repo config default
+  fncache:         no    yes     yes
+  dotencode:       no    yes     yes
+  generaldelta:    no    yes     yes
+  plain-cl-delta: yes    yes     yes
+  $ hg debugformat --verbose --config format.usegeneraldelta=no
+  format-variant repo config default
+  fncache:         no    yes     yes
+  dotencode:       no    yes     yes
+  generaldelta:    no     no     yes
+  plain-cl-delta: yes    yes     yes
   $ hg debugupgraderepo
   repository lacks features recommended by current config options: