Patchwork D6962: config: add defaults and experimental status for --debug flag

login
register
mail settings
Submitter phabricator
Date Oct. 4, 2019, 7:11 p.m.
Message ID <differential-rev-PHID-DREV-2szd7oh7a7a4fjrvh5er-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/41957/
State New
Headers show

Comments

phabricator - Oct. 4, 2019, 7:11 p.m.
navaneeth.suresh created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  This patch adds `EXPERIMENTAL` to the output of 'showconfig --debug'
  for experimental flags which are not under the `section == 'experimental'`.
  This also adds the default value of the config item if it differs from
  the current value.

REPOSITORY
  rHG Mercurial

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

AFFECTED FILES
  mercurial/commands.py
  mercurial/ui.py
  tests/test-config.t

CHANGE DETAILS




To: navaneeth.suresh, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-config.t b/tests/test-config.t
--- a/tests/test-config.t
+++ b/tests/test-config.t
@@ -972,3 +972,11 @@ 
   diff.showfunc=False
   diff.unified=None
   diff.word-diff=False
+
+  $ hg showconfig --debug --registered | grep 'cmdserver'
+  none: cmdserver.log=None
+  none: cmdserver.max-log-files=7
+  none: cmdserver.max-log-size=1 MB
+  none: cmdserver.max-repo-cache(EXPERIMENTAL)=0 (default: None)
+  none: cmdserver.message-encodings(EXPERIMENTAL)=[] (default: None)
+  none: cmdserver.track-log=[b'chgserver', b'cmdserver', b'repocache']
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -833,6 +833,9 @@ 
                     # --verbose is specified.
                     continue
                 value = self._config(section, name, untrusted=untrusted)
+                if self.debugflag:
+                    if item.experimental or 'experimental' in name:
+                        name = ''.join([name, '(EXPERIMENTAL)'])
                 yield section, name, value
 
     def plain(self, feature=None):
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1890,7 +1890,12 @@ 
             fm.data(name=entryname)
             fm.write('value', '%s\n', value)
         else:
-            fm.write('name value', '%s=%s\n', entryname, value)
+            if (opts.get('registered') and
+                value != pycompat.bytestr(defaultvalue) and ui.debugflag):
+                fm.write('name value defaultvalue', '%s=%s (default: %s)\n',
+                          entryname, value, pycompat.bytestr(defaultvalue))
+            else:
+                fm.write('name value', '%s=%s\n', entryname, value)
         matched = True
     fm.end()
     if matched: