[PATCH 3 of 3 V2] py3: fix str vs bytes in enough places to run `hg version` on Windows
Yuya Nishihara
yuya at tcha.org
Sat Sep 15 02:09:55 EDT 2018
On Fri, 14 Sep 2018 22:39:27 -0400, Matt Harbison wrote:
> # HG changeset patch
> # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1536890820 14400
> # Thu Sep 13 22:07:00 2018 -0400
> # Node ID bafe274973423eaa7a49f2f2003366fddbdaca61
> # Parent 8490cde7d20031c0c6295f5df531db02bca1a6a9
> py3: fix str vs bytes in enough places to run `hg version` on Windows
> --- a/mercurial/windows.py
> +++ b/mercurial/windows.py
> @@ -389,7 +389,7 @@ def shellquote(s):
> """
> global _quotere
> if _quotere is None:
> - _quotere = re.compile(r'(\\*)("|\\$)')
> + _quotere = re.compile(b'(\\*)("|\\$)')
> global _needsshellquote
> if _needsshellquote is None:
> # ":" is also treated as "safe character", because it is used as a part
> @@ -397,11 +397,11 @@ def shellquote(s):
> # safe because shlex.split() (kind of) treats it as an escape char and
> # drops it. It will leave the next character, even if it is another
> # "\".
> - _needsshellquote = re.compile(r'[^a-zA-Z0-9._:/-]').search
> + _needsshellquote = re.compile(b'[^a-zA-Z0-9._:/-]').search
> if s and not _needsshellquote(s) and not _quotere.search(s):
> # "s" shouldn't have to be quoted
> return s
> - return '"%s"' % _quotere.sub(r'\1\1\\\2', s)
> + return b'"%s"' % _quotere.sub(r'\1\1\\\2', s)
Fixed these to br''.
More information about the Mercurial-devel
mailing list