changeset 36617: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 dfcf589a4031
children 3790610c2793
files mercurial/util.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Fri Mar 02 14:12:17 2018 -0500
+++ b/mercurial/util.py	Thu Mar 01 18:22:36 2018 -0500
@@ -246,6 +246,10 @@
     warnings.filterwarnings(r'default', r'', DeprecationWarning, r'mercurial')
     warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext')
     warnings.filterwarnings(r'default', r'', DeprecationWarning, r'hgext3rd')
+if _dowarn and pycompat.ispy3:
+    # silence warning emitted by passing user string to re.sub()
+    warnings.filterwarnings(r'ignore', r'bad escape', DeprecationWarning,
+                            r'mercurial')
 
 def nouideprecwarn(msg, version, stacklevel=1):
     """Issue an python native deprecation warning