Patchwork [1,of,3] configitems: register the 'win32text.warn' config

login
register
mail settings
Submitter Boris Feld
Date Sept. 13, 2017, 6:36 a.m.
Message ID <2cf07eee9f82fcefb32b.1505284597@FB>
Download mbox | patch
Permalink /patch/23830/
State Accepted
Headers show

Comments

Boris Feld - Sept. 13, 2017, 6:36 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1498787156 -7200
#      ven. juin 30 03:45:56 2017 +0200
# Node ID 2cf07eee9f82fcefb32b696929695de3b2c9f816
# Parent  2603449fbeb1c6af8c0e26f18eb4d12ea0ca7b5c
# EXP-Topic config.register.win32text
configitems: register the 'win32text.warn' config

Patch

diff -r 2603449fbeb1 -r 2cf07eee9f82 hgext/win32text.py
--- a/hgext/win32text.py	mar. sept. 05 00:34:13 2017 +0200
+++ b/hgext/win32text.py	ven. juin 30 03:45:56 2017 +0200
@@ -49,6 +49,7 @@ 
     short,
 )
 from mercurial import (
+    registrar,
     util,
 )
 
@@ -58,6 +59,13 @@ 
 # leave the attribute unspecified.
 testedwith = 'ships-with-hg-core'
 
+configtable = {}
+configitem = registrar.configitem(configtable)
+
+configitem('win32text', 'warn',
+    default=True,
+)
+
 # regexp for single LF without CR preceding.
 re_single_lf = re.compile('(^|[^\r])\n', re.MULTILINE)
 
@@ -178,6 +186,6 @@ 
 
 def extsetup(ui):
     # deprecated config: win32text.warn
-    if ui.configbool('win32text', 'warn', True):
+    if ui.configbool('win32text', 'warn'):
         ui.warn(_("win32text is deprecated: "
                   "https://mercurial-scm.org/wiki/Win32TextExtension\n"))