changeset 42706:60789444acd6

config: fix fm.data() handling of defaultvalue This is a follow-up patch to rHG51a2e3102db2. This moves `fm.data()` out of the if block in `commands.config()`. Differential Revision: https://phab.mercurial-scm.org/D6720
author Navaneeth Suresh <navaneeths1998@gmail.com>
date Wed, 07 Aug 2019 19:18:20 +0530
parents 049b2ac3252e
children 3cffc7bbec26
files mercurial/commands.py tests/test-config.t
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Sat Aug 03 12:14:34 2019 +0530
+++ b/mercurial/commands.py	Wed Aug 07 19:18:20 2019 +0530
@@ -1882,10 +1882,11 @@
         fm.startitem()
         fm.condwrite(ui.debugflag, 'source', '%s: ', source)
         if uniquesel:
-            fm.data(name=entryname, defaultvalue=defaultvalue)
+            fm.data(name=entryname)
             fm.write('value', '%s\n', value)
         else:
             fm.write('name value', '%s=%s\n', entryname, value)
+        fm.data(defaultvalue=defaultvalue)
         matched = True
     fm.end()
     if matched:
--- a/tests/test-config.t	Sat Aug 03 12:14:34 2019 +0530
+++ b/tests/test-config.t	Wed Aug 07 19:18:20 2019 +0530
@@ -57,11 +57,13 @@
   $ hg showconfig Section -Tjson
   [
    {
+    "defaultvalue": null,
     "name": "Section.KeY",
     "source": "*.hgrc:*", (glob)
     "value": "Case Sensitive"
    },
    {
+    "defaultvalue": null,
     "name": "Section.key",
     "source": "*.hgrc:*", (glob)
     "value": "lower case"
@@ -77,8 +79,8 @@
    }
   ]
   $ hg showconfig -Tjson | tail -7
-   },
    {
+    "defaultvalue": null,
     "name": "*", (glob)
     "source": "*", (glob)
     "value": "*" (glob)