changeset 41537:fc09aafd3c36

convert: use raw string for regular expressions This avoids a SyntaxWarning on Python 3.8. Differential Revision: https://phab.mercurial-scm.org/D5821
author Gregory Szorc <gregory.szorc@gmail.com>
date Mon, 04 Feb 2019 09:03:10 -0800
parents fb9e11fdcbba
children b5642239fb32
files hgext/convert/monotone.py hgext/convert/p4.py
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/convert/monotone.py	Mon Feb 04 09:01:49 2019 -0800
+++ b/hgext/convert/monotone.py	Mon Feb 04 09:03:10 2019 -0800
@@ -214,7 +214,7 @@
         #   key "test@selenic.com"
         # mtn >= 0.45:
         #   key [ff58a7ffb771907c4ff68995eada1c4da068d328]
-        certlist = re.split('\n\n      key ["\[]', certlist)
+        certlist = re.split(br'\n\n      key ["\[]', certlist)
         for e in certlist:
             m = self.cert_re.match(e)
             if m:
--- a/hgext/convert/p4.py	Mon Feb 04 09:01:49 2019 -0800
+++ b/hgext/convert/p4.py	Mon Feb 04 09:03:10 2019 -0800
@@ -64,12 +64,12 @@
         self.encoding = self.ui.config('convert', 'p4.encoding',
                                        convcmd.orig_encoding)
         self.re_type = re.compile(
-            "([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
-            "(\+\w+)?$")
+            br"([a-z]+)?(text|binary|symlink|apple|resource|unicode|utf\d+)"
+            br"(\+\w+)?$")
         self.re_keywords = re.compile(
-            r"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
-            r":[^$\n]*\$")
-        self.re_keywords_old = re.compile("\$(Id|Header):[^$\n]*\$")
+            br"\$(Id|Header|Date|DateTime|Change|File|Revision|Author)"
+            br":[^$\n]*\$")
+        self.re_keywords_old = re.compile(br"\$(Id|Header):[^$\n]*\$")
 
         if revs and len(revs) > 1:
             raise error.Abort(_("p4 source does not support specifying "