On Thu, 28 Jun 2018 07:49:42 -0400, Yuya Nishihara <y...@tcha.org> wrote:

On Wed, 27 Jun 2018 08:44:26 -0400, Matt Harbison wrote:
# HG changeset patch
# User Matt Harbison <matt_harbi...@yahoo.com>
# Date 1529817189 14400
#      Sun Jun 24 01:13:09 2018 -0400
# Node ID 7ac9de5a8826fc95864ee4ba844eb8b5c9e71332
# Parent  2c2e82469b8915c8153979cd89a970b7317f882d
windows: add a method to convert Unix style command lines to Windows style

Queued, thanks.

+ elif c == b'\\' and index + 1 < pathlen and path[index + 1] == b'$':
+            # Skip '\', but only if it is escaping $
+            res += b'$'
+            index += 1

\-escape might be confusing since \ is the directory separator on Windows, and a hook command is likely to contain backslashes.

Ugh. I didn't even think about that, though I don't think path components starting with '$' are that common.

Thinking about this a bit more...

- Maybe we should drop $$ -> $ too, since that's not what a Unix shell would do, and the point of this is portability. - Escaped '$' is a problem for hg -> cmd.exe -> sh.exe. Consider `hook = echo \$var` in the config file. This gets passed to cmd.exe as `echo $var`, but that doesn't change if something other than sh.exe runs. - I think translating `'` to `"` is the most useful thing to do, but that runs into the same problem.

What do you think? Do we need an experimental knob to turn this off? I'm assuming sh.exe is rare, and there aren't a whole lot of ways to hit this in practice. I'd prefer it does the sensible thing out of the box.
_______________________________________________
Mercurial-devel mailing list
Mercurial-devel@mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel

Reply via email to