[PATCH 1 of 2 V2] util: add a way to issue deprecation warning without a UI object

Pierre-Yves David pierre-yves.david at ens-lyon.org
Sat Apr 8 05:37:20 EDT 2017



On 04/08/2017 10:16 AM, Yuya Nishihara wrote:
> On Fri, 7 Apr 2017 19:03:55 +0200, Pierre-Yves David wrote:
>> On 04/06/2017 05:44 PM, Yuya Nishihara wrote:
>>> On Thu, 6 Apr 2017 16:09:07 +0200, Pierre-Yves David wrote:
>>>>> If dirty hack allowed, I would do something like the following:
>>>>>
>>>>>   # util.py
>>>>>   def _deprecwarn(msg, version):
>>>>>       pass
>>>>>
>>>>>   # somewhere ui is available, maybe in dispatch.py
>>>>>   util._deprecwarn = ui.deprecwarn
>>>>
>>>> That is a diry hack. I would prefer we did not used it.
>>>
>>> Yeah, that is dirty and I don't like it. But I'm okay with it as long as
>>> it is a temporary hack.
>>
>> If you think the dirty hack is worth the potential extra exposure, I'm
>> fine with it.
>>
>> However, I'm confused about your usage of "temporary hack" here. Why are
>> you using temporary?
>
> I suppose the hack will hopefully disappear with the vfs compat layer. I'm not
> sure if a permanent one is necessary.

I think this kind of needs will appears again in the future. So I would 
not flag the solution as temporary. I would have made the function local 
to the scmutil module.

So I would rather have a long terms solution. What do you think?

Cheers,

-- 
Pierre-Yves David


More information about the Mercurial-devel mailing list