Skip to content
Snippets Groups Projects
Commit 6e2c8f7f authored by Matt Harbison's avatar Matt Harbison
Browse files

py3: byteify windows.shelltocmdexe()

This makes test-doctest.py happy on Windows.
parent 0f8ff3ff
No related branches found
No related tags found
No related merge requests found
......@@ -314,7 +314,7 @@
index = 0
pathlen = len(path)
while index < pathlen:
c = path[index]
c = path[index:index + 1]
if c == b'\'': # no expansion within single quotes
path = path[index + 1:]
pathlen = len(path)
......@@ -344,7 +344,7 @@
var = path[:index]
# See below for why empty variables are handled specially
if env.get(var, '') != '':
if env.get(var, b'') != b'':
res += b'%' + var + b'%'
else:
res += b'${' + var + b'}'
......@@ -365,8 +365,8 @@
# VAR, and that really confuses things like revset expressions.
# OTOH, if it's left in Unix format and the hook runs sh.exe, it
# will substitute to an empty string, and everything is happy.
if env.get(var, '') != '':
if env.get(var, b'') != b'':
res += b'%' + var + b'%'
else:
res += b'$' + var
......@@ -369,7 +369,7 @@
res += b'%' + var + b'%'
else:
res += b'$' + var
if c != '':
if c != b'':
index -= 1
elif (c == b'~' and index + 1 < pathlen
......@@ -374,5 +374,5 @@
index -= 1
elif (c == b'~' and index + 1 < pathlen
and path[index + 1] in (b'\\', b'/')):
and path[index + 1:index + 2] in (b'\\', b'/')):
res += "%USERPROFILE%"
elif (c == b'\\' and index + 1 < pathlen
......@@ -377,4 +377,4 @@
res += "%USERPROFILE%"
elif (c == b'\\' and index + 1 < pathlen
and path[index + 1] in (b'$', b'~')):
and path[index + 1:index + 2] in (b'$', b'~')):
# Skip '\', but only if it is escaping $ or ~
......@@ -380,5 +380,5 @@
# Skip '\', but only if it is escaping $ or ~
res += path[index + 1]
res += path[index + 1:index + 2]
index += 1
else:
res += c
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment