D1794: py3: make regular expressions bytes by prepending b''
pulkit (Pulkit Goyal)
phabricator at mercurial-scm.org
Fri Dec 29 00:49:26 UTC 2017
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.
REVISION SUMMARY
Regexes start with r'' and hence transformer skips adding b'' there.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D1794
AFFECTED FILES
mercurial/byterange.py
mercurial/mdiff.py
CHANGE DETAILS
diff --git a/mercurial/mdiff.py b/mercurial/mdiff.py
--- a/mercurial/mdiff.py
+++ b/mercurial/mdiff.py
@@ -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):
diff --git a/mercurial/byterange.py b/mercurial/byterange.py
--- a/mercurial/byterange.py
+++ b/mercurial/byterange.py
@@ -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))
To: pulkit, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list