py3: make sure regexes are bytes
authorPulkit Goyal <7895pulkit@gmail.com>
Sat, 24 Feb 2018 16:06:21 +0530
changeset 36393 54f4328a07c2
parent 36392 e9bcc2efb7e8
child 36394 4bc983568016
py3: make sure regexes are bytes # skip-blame because we added just b'' prefix Differential Revision: https://phab.mercurial-scm.org/D2416
hgext/convert/cvs.py
hgext/convert/monotone.py
--- a/hgext/convert/cvs.py	Sat Feb 24 16:04:57 2018 +0530
+++ b/hgext/convert/cvs.py	Sat Feb 24 16:06:21 2018 +0530
@@ -179,7 +179,7 @@
             # :ext:user@host/home/user/path/to/cvsroot
             if root.startswith(":ext:"):
                 root = root[5:]
-            m = re.match(r'(?:([^@:/]+)@)?([^:/]+):?(.*)', root)
+            m = re.match(br'(?:([^@:/]+)@)?([^:/]+):?(.*)', root)
             # Do not take Windows path "c:\foo\bar" for a connection strings
             if os.path.isdir(root) or not m:
                 conntype = "local"
--- a/hgext/convert/monotone.py	Sat Feb 24 16:04:57 2018 +0530
+++ b/hgext/convert/monotone.py	Sat Feb 24 16:06:21 2018 +0530
@@ -46,11 +46,11 @@
                 raise norepo
 
         # regular expressions for parsing monotone output
-        space    = r'\s*'
-        name     = r'\s+"((?:\\"|[^"])*)"\s*'
+        space    = br'\s*'
+        name     = br'\s+"((?:\\"|[^"])*)"\s*'
         value    = name
-        revision = r'\s+\[(\w+)\]\s*'
-        lines    = r'(?:.|\n)+'
+        revision = br'\s+\[(\w+)\]\s*'
+        lines    = br'(?:.|\n)+'
 
         self.dir_re      = re.compile(space + "dir" + name)
         self.file_re     = re.compile(space + "file" + name +