On Thu, Sep 15, 2016 at 01:37:26AM +0900, Yuya Nishihara wrote:
> On Wed, 14 Sep 2016 11:52:59 -0400, Augie Fackler wrote:
> > > On Sep 14, 2016, at 11:30, Yuya Nishihara <y...@tcha.org> wrote:
> > Is the idea something like:
> >
> > fancyopts.py:
> >
> > unsetbool = object()
> >
> > in commands.py:
> >
> >  diffopts = [
> > -     ('a', 'text', None, _('treat all files as text')),
> > +     ('a', 'text', fancyopts.unsetbool, _('treat all files as text')),
> > -     ('g', 'git', None, _('use git extended diff format')),
> > +     ('g', 'git', fancyopts.unsetbool, _('use git extended diff format')),
> > -     ('', 'nodates', None, _('omit dates from diff headers'))
> > +     ('', 'nodates', fancyopts.unsetbool, _('omit dates from diff 
> > headers'))
> >  ]
>
> Yes.
>
> > And then we could synthesize negated versions only for booleans that have
> > fancyopts.unsetbool as the default?
>
> No. My idea is to not set 'git' at all.
>
>   default:  {}  # not {'git': None}
>   --git:    {'git': True}
>   --no-git: {'git': False}
>
> and falls back to ui.configbool if 'git' not in opts.
>
> My point is diffopts are special in that their defaults are configurable. Many
> other boolean options have no such feature, so they can simply be default=None
> (or False.)

Yeah. I'm running out of energy on this topic, and this doesn't look
like it's an easy refactor to me. Can we map out a path that works
with the existing True/False/None tri-state for the time being, and
consider coming back to this later?

I like the idea of command line flags that can tie in to config
options (this would actually be a huge win for hgsubversion, we've got
some nasty code there to handle it), but it feels like an annoying
refactor that is mostly orthogonal to my actual goals here.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to