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

Yuya Nishihara yuya at tcha.org
Sun Apr 9 09:08:13 EDT 2017


On Sat, 8 Apr 2017 11:37:20 +0200, Pierre-Yves David wrote:
> 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?

If we need less ad-hoc one, I would add a global flag to enable deprecwarn
and set it only by global configuration (i.e. ui, not lui nor repo.ui.)
And perhaps will remove ui.deprecwarn() in favor of util.deprecwarn().


More information about the Mercurial-devel mailing list