[PATCH] win32text: give deprecation warning

Martin Geisler mg at lazybytes.net
Mon Oct 25 16:45:19 UTC 2010


steve at borho.org writes:

> # HG changeset patch
> # User Steve Borho <steve at borho.org>
> # Date 1288024172 18000
> # Branch stable
> # Node ID 73ccf37df7565a036d3807312492bacd2f9a9801
> # Parent  d8205dacf9a3360093c7670b6436de3ed6a23db1
> win32text: give deprecation warning
>
> Users need to migrate to the EOL extension for various reasons.

This sounds like a good idea.

> Instructions for disabling the warning will be added to the
> extension's wiki page.
>
> diff -r d8205dacf9a3 -r 73ccf37df756 hgext/win32text.py
> --- a/hgext/win32text.py
> +++ b/hgext/win32text.py
> @@ -158,9 +158,17 @@
>  def forbidcr(ui, repo, hooktype, node, **kwargs):
>      return forbidnewline(ui, repo, hooktype, node, '\r', **kwargs)
>  
> +deprwarn = True
>  def reposetup(ui, repo):
>      if not repo.local():
>          return
> +    global deprwarn
> +    if deprwarn:
> +        if ui.configbool('win32text', 'warn', True):
> +            ui.warn(_("win32text is deprecated, see "
> +                      "http://mercurial.selenic.com/wiki/Win32TextExtension\n"))
> +        deprwarn = False

Would it not be better to put the warning into extsetup?

-- 
Martin Geisler

Mercurial links: http://mercurial.ch/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-devel/attachments/20101025/6697c158/attachment.asc>


More information about the Mercurial-devel mailing list