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