[PATCH] win32text: give deprecation warning

Steve Borho steve at borho.org
Mon Oct 25 13:42:00 CDT 2010


On Mon, Oct 25, 2010 at 11:45 AM, Martin Geisler <mg at lazybytes.net> wrote:
> 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?

Good point.  I've pushed a modified version that does just that.  I
also shortened the message a bit so that it fit under 80 chars.

-- 
Steve Borho


More information about the Mercurial-devel mailing list