[1,of,2,RFC] RFC: implement immutable config objects

Yuya Nishihara yuya at tcha.org
Sun Apr 2 01:08:51 EDT 2017


On Sat, 1 Apr 2017 15:56:25 -0700, Jun Wu wrote:
> Excerpts from Yuya Nishihara's message of 2017-04-01 23:39:34 +0900:
> > > > +                    yield (section, item, (value, source))
> > 
> > We might want to keep filename and line number separately in future version.
> 
> Since there are other sources like "setconfig", "--config", "--verbose", and
> the new "$ENVNAME", maybe "source" needs to a tuple or something more
> complex / typed. But it's probably another series.

Yeah, that's kinda unrelated topic to the core functions in this series.
I just recalled someone (Mathias?) wanted to get source filenames.

> The immutable configs (other than fileconfig) do not assume the format of
> the tuple "(section, item, value)". So if we do change it to "(section,
> item, (value, ('file', path, line)))", other objects won't need change.

> > > > +class filteredconfig(abstractimmutableconfig):
> > > > +    """immutable config that changes other configs"""
> > > > +
> > > > +    def __init__(self, title, subconfig, filters=None):
> > > > +        """
> > > > +        filters: a dict-ish, {section: filterfunc or sortdict-ish}
> > > > +                 a filterfunc takes sortdict-ish and returns sortdict-ish
> > > > +                 a sortdict-ish will replace the section directly
> > > > +        """
> > 
> > So this is more like "map" operation? I thought filterfunc would return
> > booleans.
> 
> It should probably be renamed to "transformfunc".

and "transformedconfig" respectively, maybe.


More information about the Mercurial-devel mailing list