comparison mercurial/util.py @ 36588:281f66777ff0

py3: silence "bad escape" warning emitted by re.sub() Since we pass user strings directly to re.sub(), we can't avoid this warning without a BC.
author Yuya Nishihara <yuya@tcha.org>
date Thu, 01 Mar 2018 18:22:36 -0500
parents 26a6b62919e2
children c6061cadb400
comparison
equal deleted inserted replaced
36587:dfcf589a4031 36588:281f66777ff0
244 # we cannot set 'mercurial' and have it match eg: 'mercurial.scmutil'. This 244 # we cannot set 'mercurial' and have it match eg: 'mercurial.scmutil'. This
245 # makes the whole PYTHONWARNINGS thing useless for our usecase. 245 # makes the whole PYTHONWARNINGS thing useless for our usecase.
246 warnings.filterwarnings(r'default', r'', DeprecationWarning, r'mercurial') 246 warnings.filterwarnings(r'default', r'', DeprecationWarning, r'mercurial')
247 warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext') 247 warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext')
248 warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext3rd') 248 warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext3rd')
249 if _dowarn and pycompat.ispy3:
250 # silence warning emitted by passing user string to re.sub()
251 warnings.filterwarnings(r'ignore', r'bad escape', DeprecationWarning,
252 r'mercurial')
249 253
250 def nouideprecwarn(msg, version, stacklevel=1): 254 def nouideprecwarn(msg, version, stacklevel=1):
251 """Issue an python native deprecation warning 255 """Issue an python native deprecation warning
252 256
253 This is a noop outside of tests, use 'ui.deprecwarn' when possible. 257 This is a noop outside of tests, use 'ui.deprecwarn' when possible.