py3: make regular expressions bytes by prepending b''
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 29 Dec 2017 05:28:05 +0530
changeset 35584 6f62a1c3e11d
parent 35583 2f123f309f61
child 35585 35fb3367f72d
py3: make regular expressions bytes by prepending b'' Regexes start with r'' and hence transformer skips adding b'' there. # skip-blame because we are just adding b'' Differential Revision: https://phab.mercurial-scm.org/D1794
mercurial/byterange.py
mercurial/mdiff.py
--- a/mercurial/byterange.py	Fri Dec 29 05:27:00 2017 +0530
+++ b/mercurial/byterange.py	Fri Dec 29 05:28:05 2017 +0530
@@ -416,7 +416,7 @@
     if range_header is None:
         return None
     if _rangere is None:
-        _rangere = re.compile(r'^bytes=(\d{1,})-(\d*)')
+        _rangere = re.compile(br'^bytes=(\d{1,})-(\d*)')
     match = _rangere.match(range_header)
     if match:
         tup = range_tuple_normalize(match.group(1, 2))
--- a/mercurial/mdiff.py	Fri Dec 29 05:27:00 2017 +0530
+++ b/mercurial/mdiff.py	Fri Dec 29 05:28:05 2017 +0530
@@ -100,7 +100,7 @@
     if blank and opts.ignoreblanklines:
         text = re.sub('\n+', '\n', text).strip('\n')
     if opts.ignorewseol:
-        text = re.sub(r'[ \t\r\f]+\n', r'\n', text)
+        text = re.sub(br'[ \t\r\f]+\n', r'\n', text)
     return text
 
 def splitblock(base1, lines1, base2, lines2, opts):