Submitter | phabricator |
---|---|
Date | Aug. 7, 2019, 1:51 p.m. |
Message ID | <differential-rev-PHID-DREV-mumu2etvud4d4kmihpft-req@mercurial-scm.org> |
Download | mbox | patch |
Permalink | /patch/41195/ |
State | Superseded |
Headers | show |
Comments
pulkit added a comment. This patch also needs a better description, something like: `config: fix fm.data() handling of defaultvalue`. INLINE COMMENTS > commands.py:1884 > fm.condwrite(ui.debugflag, 'source', '%s: ', source) > + fm.data(name=entryname, defaultvalue=defaultvalue) > if uniquesel: A better fix will be to move `fm.data(name=entryname)` inside the if, i.e. where it was before https://phab.mercurial-scm.org/D6704. And add `fm.data(defaultvalue=...)` below the if-else which will also move the `defaultvalue` to last in json output. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6720/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6720 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel
navaneeth.suresh added inline comments. INLINE COMMENTS > pulkit wrote in commands.py:1884 > A better fix will be to move `fm.data(name=entryname)` inside the if, i.e. where it was before https://phab.mercurial-scm.org/D6704. > > And add `fm.data(defaultvalue=...)` below the if-else which will also move the `defaultvalue` to last in json output. I did this but, couldn't see a difference in the test output. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6720/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6720 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, mercurial-devel
pulkit added inline comments. INLINE COMMENTS > navaneeth.suresh wrote in commands.py:1884 > I did this but, couldn't see a difference in the test output. ah, I guess the output is sorted. Anyway, the suggested one is a correct way to do this, because otherwise we are writing name to fm two times in case of `uniquesel`. REPOSITORY rHG Mercurial CHANGES SINCE LAST ACTION https://phab.mercurial-scm.org/D6720/new/ REVISION DETAIL https://phab.mercurial-scm.org/D6720 To: navaneeth.suresh, #hg-reviewers Cc: pulkit, 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 @@ -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) diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -1881,8 +1881,8 @@ continue fm.startitem() fm.condwrite(ui.debugflag, 'source', '%s: ', source) + fm.data(name=entryname, defaultvalue=defaultvalue) if uniquesel: - fm.data(name=entryname, defaultvalue=defaultvalue) fm.write('value', '%s\n', value) else: fm.write('name value', '%s=%s\n', entryname, value)