py3: make the regular expression bytes to prevent TypeError
authorPulkit Goyal <7895pulkit@gmail.com>
Fri, 17 Mar 2017 05:10:58 +0530
changeset 31491 492c64afc54c
parent 31490 8122cc5cb543
child 31492 3c77414a0f9c
py3: make the regular expression bytes to prevent TypeError
mercurial/dispatch.py
mercurial/posix.py
--- a/mercurial/dispatch.py	Sat Feb 25 17:29:30 2017 +0900
+++ b/mercurial/dispatch.py	Fri Mar 17 05:10:58 2017 +0530
@@ -286,7 +286,7 @@
             if num < len(givenargs):
                 return givenargs[num]
             raise error.Abort(_('too few arguments for command alias'))
-        cmd = re.sub(r'\$(\d+|\$)', replacer, cmd)
+        cmd = re.sub(br'\$(\d+|\$)', replacer, cmd)
         givenargs = [x for i, x in enumerate(givenargs)
                      if i not in nums]
         args = pycompat.shlexsplit(cmd)
--- a/mercurial/posix.py	Sat Feb 25 17:29:30 2017 +0900
+++ b/mercurial/posix.py	Fri Mar 17 05:10:58 2017 +0530
@@ -408,7 +408,7 @@
         return '"%s"' % s
     global _needsshellquote
     if _needsshellquote is None:
-        _needsshellquote = re.compile(r'[^a-zA-Z0-9._/+-]').search
+        _needsshellquote = re.compile(br'[^a-zA-Z0-9._/+-]').search
     if s and not _needsshellquote(s):
         # "s" shouldn't have to be quoted
         return s