Patchwork D2416: py3: make sure regexes are bytes

login
register
mail settings
Submitter phabricator
Date Feb. 24, 2018, 12:56 p.m.
Message ID <0a509540257f67f82d0dc7eab8db48b2@localhost.localdomain>
Download mbox | patch
Permalink /patch/28322/
State Not Applicable
Headers show

Comments

phabricator - Feb. 24, 2018, 12:56 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG54f4328a07c2: py3: make sure regexes are bytes (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2416?vs=6040&id=6048

REVISION DETAIL
  https://phab.mercurial-scm.org/D2416

AFFECTED FILES
  hgext/convert/cvs.py
  hgext/convert/monotone.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/hgext/convert/monotone.py b/hgext/convert/monotone.py
--- a/hgext/convert/monotone.py
+++ b/hgext/convert/monotone.py
@@ -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 +
diff --git a/hgext/convert/cvs.py b/hgext/convert/cvs.py
--- a/hgext/convert/cvs.py
+++ b/hgext/convert/cvs.py
@@ -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"