##// END OF EJS Templates
py3: byteify windows.shelltocmdexe()...
Matt Harbison -
r39946:6e2c8f7f default
parent child Browse files
Show More
@@ -314,7 +314,7 b' def shelltocmdexe(path, env):'
314 314 index = 0
315 315 pathlen = len(path)
316 316 while index < pathlen:
317 c = path[index]
317 c = path[index:index + 1]
318 318 if c == b'\'': # no expansion within single quotes
319 319 path = path[index + 1:]
320 320 pathlen = len(path)
@@ -344,7 +344,7 b' def shelltocmdexe(path, env):'
344 344 var = path[:index]
345 345
346 346 # See below for why empty variables are handled specially
347 if env.get(var, '') != '':
347 if env.get(var, b'') != b'':
348 348 res += b'%' + var + b'%'
349 349 else:
350 350 res += b'${' + var + b'}'
@@ -365,20 +365,20 b' def shelltocmdexe(path, env):'
365 365 # VAR, and that really confuses things like revset expressions.
366 366 # OTOH, if it's left in Unix format and the hook runs sh.exe, it
367 367 # will substitute to an empty string, and everything is happy.
368 if env.get(var, '') != '':
368 if env.get(var, b'') != b'':
369 369 res += b'%' + var + b'%'
370 370 else:
371 371 res += b'$' + var
372 372
373 if c != '':
373 if c != b'':
374 374 index -= 1
375 375 elif (c == b'~' and index + 1 < pathlen
376 and path[index + 1] in (b'\\', b'/')):
376 and path[index + 1:index + 2] in (b'\\', b'/')):
377 377 res += "%USERPROFILE%"
378 378 elif (c == b'\\' and index + 1 < pathlen
379 and path[index + 1] in (b'$', b'~')):
379 and path[index + 1:index + 2] in (b'$', b'~')):
380 380 # Skip '\', but only if it is escaping $ or ~
381 res += path[index + 1]
381 res += path[index + 1:index + 2]
382 382 index += 1
383 383 else:
384 384 res += c
General Comments 0
You need to be logged in to leave comments. Login now