D1794: py3: make regular expressions bytes by prepending b''

pulkit (Pulkit Goyal) phabricator at mercurial-scm.org
Wed Jan 10 23:04:03 UTC 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6f62a1c3e11d: py3: make regular expressions bytes by prepending b'' (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D1794?vs=4671&id=4777

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, durin42
Cc: durin42, mercurial-devel


More information about the Mercurial-devel mailing list