[PATCH 1 of 7] develwarn: move config gating inside the develwarn function

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sun May 8 04:41:05 EDT 2016


Good catch, I fixed that and pushed the series.

On 05/06/2016 05:25 AM, Yuya Nishihara wrote:
> On Thu, 05 May 2016 19:05:51 +0200, Pierre-Yves David wrote:
>> # HG changeset patch
>> # User Pierre-Yves David <pierre-yves.david at ens-lyon.org>
>> # Date 1462456668 -7200
>> #      Thu May 05 15:57:48 2016 +0200
>> # Node ID 4e60a6b778f63b58e62849999d70660c8d29cf8f
>> # Parent  e0e72d67a8cd370218453ca0444e02aadabd56a8
>> # EXP-Topic develwarn
>> develwarn: move config gating inside the develwarn function
>>
>> The config gating is almost always the same and contributor tend to forget it.
>> We move the logic inside the function. Call site will be updated in later
>> changeset. We might make the sub config mandatory in the future (once all old
>> call sites are gone).
>>
>> diff -r e0e72d67a8cd -r 4e60a6b778f6 mercurial/ui.py
>> --- a/mercurial/ui.py	Sun Apr 17 13:06:44 2016 +0900
>> +++ b/mercurial/ui.py	Thu May 05 15:57:48 2016 +0200
>> @@ -1135,12 +1135,15 @@ class ui(object):
>>           '''
>>           return msg
>>   
>> -    def develwarn(self, msg, stacklevel=1):
>> +    def develwarn(self, msg, stacklevel=1, config=None):
>>           """issue a developer warning message
>>   
>>           Use 'stacklevel' to report the offender some layers further up in the
>>           stack.
>>           """
>> +        if not self.configbool('devel', 'all-warnings'):
>> +            if config is not None or not self.configbool('devel', config):
>> +                return
> Perhaps "config is not None 'and' not self.configbool('devel', config)". Other
> than that, the series looks good to me.
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel



More information about the Mercurial-devel mailing list