[PATCH 5 of 6] py3: add r'' to make the regex pattern bytes
Pulkit Goyal
7895pulkit at gmail.com
Mon Jun 26 09:24:46 EDT 2017
# HG changeset patch
# User Pulkit Goyal <7895pulkit at gmail.com>
# Date 1498340515 -19800
# Sun Jun 25 03:11:55 2017 +0530
# Node ID 9b4f630d4488873d10af57cc28522655736df752
# Parent a4ababd6d202fa9575020df07bd7bde1d7575203
py3: add r'' to make the regex pattern bytes
diff --git a/mercurial/patch.py b/mercurial/patch.py
--- a/mercurial/patch.py
+++ b/mercurial/patch.py
@@ -2735,10 +2735,10 @@
if line and line[-1] in '+-':
name, graph = line.rsplit(' ', 1)
yield (name + ' ', '')
- m = re.search(r'\++', graph)
+ m = re.search(br'\++', graph)
if m:
yield (m.group(0), 'diffstat.inserted')
- m = re.search(r'-+', graph)
+ m = re.search(br'-+', graph)
if m:
yield (m.group(0), 'diffstat.deleted')
else:
diff --git a/mercurial/ui.py b/mercurial/ui.py
--- a/mercurial/ui.py
+++ b/mercurial/ui.py
@@ -1249,7 +1249,7 @@
# prompt to start parsing. Sadly, we also can't rely on
# choices containing spaces, ASCII, or basically anything
# except an ampersand followed by a character.
- m = re.match(r'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt)
+ m = re.match(br'(?s)(.+?)\$\$([^\$]*&[^ \$].*)', prompt)
msg = m.group(1)
choices = [p.strip(' ') for p in m.group(2).split('$$')]
return (msg,
diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -2840,7 +2840,7 @@
return True # remote URL
if hasdriveletter(self.path):
return True # absolute for our purposes - can't be joined()
- if self.path.startswith(r'\\'):
+ if self.path.startswith(br'\\'):
return True # Windows UNC path
if self.path.startswith('/'):
return True # POSIX-style
More information about the Mercurial-devel
mailing list