This is an archive of the discontinued Mercurial Phabricator instance.

config: fix fm.data() handling of defaultvalue
ClosedPublic

Authored by navaneeth.suresh on Aug 7 2019, 9:50 AM.

Details

Summary

This is a follow-up patch to rHG51a2e3102db2. This moves
fm.data() out of the if block in commands.config().

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

pulkit added a subscriber: pulkit.Aug 7 2019, 10:24 AM

This patch also needs a better description, something like: config: fix fm.data() handling of defaultvalue.

mercurial/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.

navaneeth.suresh retitled this revision from config: fix defaultvalue template keyword (patch 2 of 2) to config: fix fm.data() handling of defaultvalue.Aug 7 2019, 10:39 AM
mercurial/commands.py
1884

I did this but, couldn't see a difference in the test output.

pulkit added inline comments.Aug 7 2019, 11:07 AM
mercurial/commands.py
1884

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.

pulkit accepted this revision.Aug 7 2019, 5:09 PM
This revision is now accepted and ready to land.Aug 7 2019, 5:09 PM
This revision was automatically updated to reflect the committed changes.