Patchwork [7,of,8,py3] util: use bytes re on bytes input in fspath

login
register
mail settings
Submitter Augie Fackler
Date March 19, 2017, 6:11 a.m.
Message ID <71e1dc3a007cb77ca1db.1489903898@imladris.local>
Download mbox | patch
Permalink /patch/19446/
State Accepted
Headers show

Comments

Augie Fackler - March 19, 2017, 6:11 a.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1489896999 14400
#      Sun Mar 19 00:16:39 2017 -0400
# Node ID 71e1dc3a007cb77ca1db3c6c8d73acf94b0be653
# Parent  e9574463681c17cc07e37073beecf16c1b3a82ab
util: use bytes re on bytes input in fspath

Fixes `hg add` on Python 3.

Patch

diff --git a/mercurial/util.py b/mercurial/util.py
--- a/mercurial/util.py
+++ b/mercurial/util.py
@@ -1331,7 +1331,7 @@  def fspath(name, root):
         seps = seps + pycompat.osaltsep
     # Protect backslashes. This gets silly very quickly.
     seps.replace('\\','\\\\')
-    pattern = remod.compile(r'([^%s]+)|([%s]+)' % (seps, seps))
+    pattern = remod.compile(br'([^%s]+)|([%s]+)' % (seps, seps))
     dir = os.path.normpath(root)
     result = []
     for part, sep in pattern.findall(name):