# HG changeset patch # User Navaneeth Suresh # Date 2019-08-07 13:48:20 # Node ID 60789444acd6c8b31615482e0f4ba4588abb8259 # Parent 049b2ac3252e15a5bbfb5a4bec0ec88e0884603e 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 diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1882,10 +1882,11 @@ def config(ui, repo, *values, **opts): 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: diff --git a/tests/test-config.t b/tests/test-config.t --- a/tests/test-config.t +++ b/tests/test-config.t @@ -57,11 +57,13 @@ Test case sensitive configuration $ 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 @@ Test case sensitive configuration } ] $ hg showconfig -Tjson | tail -7 - }, { + "defaultvalue": null, "name": "*", (glob) "source": "*", (glob) "value": "*" (glob)