[PATCH RFC v3] scmutil: add a simple key-value file helper

Jun Wu quark at fb.com
Tue Dec 6 08:48:54 EST 2016


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.


More information about the Mercurial-devel mailing list