[PATCH] hooks: allow Unix style environment variables on external Windows hooks
Matt Harbison
mharbison72 at gmail.com
Tue Jul 4 02:02:11 UTC 2017
On Mon, 03 Jul 2017 12:33:09 -0400, FUJIWARA Katsunori
<foozy at lares.dti.ne.jp> wrote:
> At Mon, 3 Jul 2017 22:32:32 +0900,
> Yuya Nishihara wrote:
>>
>> On Sun, 02 Jul 2017 01:45:00 -0400, Matt Harbison wrote:
>> > # HG changeset patch
>> > # User Matt Harbison <matt_harbison at yahoo.com>
>> > # Date 1498969929 14400
>> > # Sun Jul 02 00:32:09 2017 -0400
>> > # Node ID 5684913c02965f4a6bb43320e8aa189333962dd1
>> > # Parent 61ed2cc98fd17c50c7adf634d777d946781a9fc1
>> > hooks: allow Unix style environment variables on external Windows
>> hooks
>> >
>> > This will help making common hooks between Windows and non-Windows
>> platforms.
>> > The hook is launched via cmd.exe, which doesn't understand $var, nor
>> single
>> > quotes. Therefore, all that is handled is converting $var to %var%,
>> and
>> > allowing a literal '$' if escaped with '\'. Like Unix variables,
>> Windows will
>> > substitute in the middle of a word (e.g. foo%bar%), so I don't think
>> there are
>> > any other special cases to handle.
>>
>> (+CC foozy, another Windows expert)
>>
>> Perhaps we'll need to update the help. '$' could be included in a valid
>> filename, which now escape is required.
>
> Should we add config knob to opt-in this behavior, in order to avoid
> replacement for intentional "$" usage in existing configurations ?
>
> As Matt described, I think that using "$" literal on Windows is rare
> case, too, though :-)
I'd rather not do that- it seems way too rare to be worthwhile. We've
slightly changed parsing rules in the past without issue, like making an
're:' prefix mean regex for various revsets.
More information about the Mercurial-devel
mailing list