[PATCH RFC v3] scmutil: add a simple key-value file helper
kobalyts at outlook.com
Tue Dec 6 08:54:02 EST 2016
On 12/6/16 1:48 PM, Jun Wu wrote:
> Excerpts from Kostia Balytskyi's message of 2016-12-06 13:39:31 +0000:
>> Hm, I don't see how upper/lower-case instead of explicit boolean flag
>> handles that...
> I didn't realize the issue either, before Yuya's reply.
>> But to answer your question:
>> 1. When you add a new field and you mark it as required, you really have
>> only two options:
>> a. Breaking backwards compatibility. I guess this is wanted rarely.
>> b. Adding a logic to replace the missing required field with some
>> default value. My opinion is that such logic should exist outside of
>> simplekeyvaluefile implementation, so from this class' perspective that
>> field is still optional
>> 2. When you remove a required field or make field which was required
>> optional. Because we don't limit the optional
>> fields in any way, this should just work - unexpected field in the file
>> is just read and stored in the dictionary.
> It seems that the user of simplekeyvaluefile have to deal with "required" /
> "optional" etc.
> How about just removing the "required" check in simplekeyvaluefile?
> Leave them to the user to handle. That seems cleaner to me.
This is what happens if you don't inherit the class or don't override
the empty KEYS list in the inherited class.
More information about the Mercurial-devel