[PATCH STABLE] singlehead: making config item a bool again
Pierre-Yves David
pierre-yves.david at ens-lyon.org
Thu Nov 21 08:43:26 EST 2019
On 11/21/19 1:50 PM, Georges Racinet wrote:
> On 11/21/19 1:38 PM, Yuya Nishihara wrote:
>> On Wed, 20 Nov 2019 19:23:26 +0100, Georges Racinet wrote:
>>> # HG changeset patch
>>> # User Georges Racinet <georges.racinet at octobus.net>
>>> # Date 1574273222 -3600
>>> # Wed Nov 20 19:07:02 2019 +0100
>>> # Branch stable
>>> # Node ID c557e15674ea6adfe1b034e5b4af1e26bca850dd
>>> # Parent ca3dca416f8d5863ca6f5a4a6a6bb835dcd5feeb
>>> # EXP-Topic single_head_is_boolean
>>> singlehead: making config item a bool again
>>>
>>> with the use of `configsuboptions`, the main config item has become
>>> a string (unless it's just the default value).
>>>
>>> This makes it in particular hard to override in a cascade of HGRC files,
>>> as we do in Heptapod to re-allow multiple heads on specific repositories
>>> while the default behaviour is to forbid them. The added test case
>>> reflects
>>> that use-case
>>>
>>> diff -r ca3dca416f8d -r c557e15674ea mercurial/localrepo.py
>>> --- a/mercurial/localrepo.py Tue Nov 05 21:35:19 2019 +0900
>>> +++ b/mercurial/localrepo.py Wed Nov 20 19:07:02 2019 +0100
>>> @@ -2090,6 +2090,8 @@
>>> b'experimental', b'single-head-per-branch'
>>> )
>>> singlehead, singleheadsub = r
>>> + if singlehead is not None and not isinstance(singlehead,
>>> bool):
>>> + singlehead = stringutil.parsebool(singlehead)
> Thanks for having looked at this
>> Maybe it's better to use ui.configbool() to check if the config value can
>> be parsed as bool.
>>
>> singlehead, singleheadsub = ui.configsuboptions(...)
>> singlehead = ui.configbool(...)
>
> I wasn't sure whether it'd be a bit slower because of redoing partly
> what `configsuboptions` had already done.
I don't think the performance is a concern here (otherwise there are a
lot of more important slowdown in that code)
>
> Then why not make explicit that we don't want the first value given by
> `configsuboptions`,, then :
>
> _, singleheadsub = ui.configsuboptions(...) (or even
> singleheadsub = ui.configsuboptions(...)[1])
>
> singlehead = ui.configbool(...)
>
> I'll amend and resubmit according to your prefererence
>
--
Pierre-Yves David
More information about the Mercurial-devel
mailing list