[PATCH RFC] ui: add support for a tweakdefaults knob

Yuya Nishihara yuya at tcha.org
Mon Jun 19 09:31:35 EDT 2017


On Sun, 18 Jun 2017 21:59:28 -0400, Augie Fackler wrote:
> 
> > On Jun 17, 2017, at 01:01, Yuya Nishihara <yuya at tcha.org> wrote:
> > 
> >>> I have no idea how we should process values which are only set in untrusted
> >>> config. Using hasconfig(untrusted=True) might be a bit safer, but there would
> >>> still be inconsistency.
> >> 
> >> I thought untrusted was the default? Or do you just want it explicit?
> > 
> > untrusted is False by default. I think this and the repo config problems can
> > be mitigated by not setting tweaked values to _ocfg.
> > 
> >   if not tcfg.hasitem(section, name):
> >       tcfg.set(section, name, value, "<tweakdefaults>")
> >   if not ucfg.hasitem(section, name):
> >       ucfg.set(section, name, value, "<tweakdefaults>")
> >   fixconfig()
> 
> Oh, I see the problem now. I'm not sure how to address that. It was intentional that tweakdefaults is only respected if it's a trusted config entry, so all its items can be treated as trusted.

I agree it's probably okay to ignore an untrusted tweakdefaults option.

> I think your fix sounds reasonable for the setting of the config items. Should I roll a v3 that moves the tweakdefaults() call to dispatch and make it work this way instead of on (ab)using ui.setconfig?

Not using setconfig() sounds nice, too.


More information about the Mercurial-devel mailing list