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

Jun Wu quark at fb.com
Tue Dec 6 09:45:49 EST 2016


Excerpts from Kostia Balytskyi's message of 2016-12-06 14:30:18 +0000:
> 
> On 12/6/16 2:08 PM, Jun Wu wrote:
> > Excerpts from Kostia Balytskyi's message of 2016-12-06 13:54:02 +0000:
> >> This is what happens if you don't inherit the class or don't override
> >> the empty KEYS list in the inherited class.
> > If KEYS is used to verify existence, how about just making it a list of
> > strings, instead of tuples? The "required" boolean flag seems to be
> > unnecessary.
> That is true and I've thought about it: just store the list of required 
> keys in KEYS.
> The reason I want optional keys to be in this list is verbosity. I 
> someone else wrote
> the subclass for some key-value file, I as a maintainer have a single 
> place to see all
> the fields "desired" (required and optional) by current version of code. 
> So the purpose
> of optional keys there is documentation and readability.

Then how about explicit "REQUIREDKEYS" and "OPTIONALKEYS"?

It seems sub-optimal to me that the "verify" method has to go through keys
unnecessarily.


More information about the Mercurial-devel mailing list