Page MenuHomePhabricator

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

Authored by navaneeth.suresh on Wed, Aug 7, 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.Wed, Aug 7, 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.Wed, Aug 7, 10:39 AM
mercurial/commands.py
1884

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

pulkit added inline comments.Wed, Aug 7, 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.Wed, Aug 7, 5:09 PM
This revision is now accepted and ready to land.Wed, Aug 7, 5:09 PM
This revision was automatically updated to reflect the committed changes.