diff mercurial/commands.py @ 42699:51a2e3102db2

config: add defaultvalue template keyword This patch tries to fix one of the issues mentioned in issue6014. This adds a new `defaultvalue` template keyword to be used with `hg showconfig` to get the default value of the config item. Differential Revision: https://phab.mercurial-scm.org/D6704
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Thu, 01 Aug 2019 22:03:52 +0530
parents 0795bbe8ed19
children 049b2ac3252e
line wrap: on
line diff
--- a/mercurial/commands.py	Thu Aug 01 12:23:07 2019 -0400
+++ b/mercurial/commands.py	Thu Aug 01 22:03:52 2019 +0530
@@ -1872,6 +1872,7 @@
     for section, name, value in ui.walkconfig(untrusted=untrusted):
         source = ui.configsource(section, name, untrusted)
         value = pycompat.bytestr(value)
+        defaultvalue = pycompat.bytestr(ui.configdefault(section, name))
         if fm.isplain():
             source = source or 'none'
             value = value.replace('\n', '\\n')
@@ -1881,7 +1882,7 @@
         fm.startitem()
         fm.condwrite(ui.debugflag, 'source', '%s: ', source)
         if uniquesel:
-            fm.data(name=entryname)
+            fm.data(name=entryname, defaultvalue=defaultvalue)
             fm.write('value', '%s\n', value)
         else:
             fm.write('name value', '%s=%s\n', entryname, value)