[PATCH 08 of 11] configitems: register the full 'merge-tools' config and sub-options

Yuya Nishihara yuya at tcha.org
Tue Oct 17 11:11:46 EDT 2017


On Mon, 16 Oct 2017 16:00:26 +0200, Boris Feld wrote:
> On Fri, 2017-10-13 at 15:37 -0400, Augie Fackler wrote:
> > On Fri, Oct 13, 2017 at 07:55:14PM +0200, Boris Feld wrote:
> > > # HG changeset patch
> > > # User Boris Feld <boris.feld at octobus.net>
> > > # Date 1507487833 -7200
> > > #      Sun Oct 08 20:37:13 2017 +0200
> > > # Node ID 6ad9f6f42f33fe5efb78f76d39c41f28333144d6
> > > # Parent  0824a3519c14d643a81dd4f718846f15045772ec
> > > # EXP-Topic config.register.ready
> > > # Available At https://bitbucket.org/octobus/mercurial-devel/
> > > #              hg pull https://bitbucket.org/octobus/mercurial-deve
> > > l/ -r 6ad9f6f42f33
> > > configitems: register the full 'merge-tools' config and sub-options
> > > 
> > > We register the merge-tools config section (which has an arbitrary
> > > base config
> > > value) and the possible sub-attribute. The sub-attribute has to be
> > > registered
> > > first or at the same time otherwise the '.*' item would shadow
> > > them.
> > > 
> > > diff --git a/mercurial/configitems.py b/mercurial/configitems.py
> > > --- a/mercurial/configitems.py
> > > +++ b/mercurial/configitems.py
> > > @@ -498,6 +498,60 @@
> > >  coreconfigitem('merge', 'preferancestor',
> > >          default=lambda: ['*'],
> > >  )
> > > +coreconfigitem('merge-tools', '.*',
> > > +    default=None,
> > > +    generic=True,
> > > +)
> > 
> > Shouldn't this be [^.]*, since a . means a sub-attribute?
> 
> I think . are authorized in merge-tools definitions without meaning a
> sub-attribute, so we cannot exclude it from matching.
> 
> > 
> > > +coreconfigitem('merge-tools', r'.*\.args$',
> > > +    default="$local $base $other",
> > > +    generic=True,
> > > +    priority=-1,
> > > +)

Maybe it's too late to change, but if the match function were re.search(),
we can easily write a suffix match without using greedy .* pattern.


More information about the Mercurial-devel mailing list