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

login
register
mail settings
Submitter phabricator
Date Jan. 10, 2018, 11:04 p.m.
Message ID <b5bf658637d920a42d27ca1799ee6d2e@localhost.localdomain>
Download mbox | patch
Permalink /patch/26660/
State Not Applicable
Headers show

Comments

phabricator - Jan. 10, 2018, 11:04 p.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG6f62a1c3e11d: py3: make regular expressions bytes by prepending b&#039;&#039; (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




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

Patch

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))