##// END OF EJS Templates
run-tests: include quotes in the HGEDITOR value when storing sys.executable...
run-tests: include quotes in the HGEDITOR value when storing sys.executable This fixes test-install.t on Windows that broke in 2122b82b6987 when shlex.split() was added to the debuginstall command: @@ -7,8 +7,11 @@ checking installed modules (*mercurial)... (glob) checking templates (*mercurial?templates)... (glob) checking commit editor... + Can't find editor 'c:\Python27\python.exe -c "(omitted)"' in PATH + (specify a commit editor in your configuration file) checking username... - no problems detected + 1 problems detected, please check your install! + [1] What happens is that shlex.split() on Windows turns this: c:\Python27\python.exe -c "import sys; sys.exit(0)" into this: ['c:Python27python.exe', '-c', 'import sys; sys.exit(0)'] While technically a regression, most programs on Windows live in some flavor of 'Program Files', and therefore the environment variable needs to contain quotes anyway to handle the space. This wasn't handled prior to the shlex() change, because it tested the whole environment variable to see if it was an executable, or split on the first space and tested again.

File last commit:

r23172:e955549c default
r23347:49cdf51c default
Show More
test-config.t
92 lines | 1.7 KiB | text/troff | Tads3Lexer
hide outer repo
$ hg init
Invalid syntax: no value
$ cat > .hg/hgrc << EOF
> novaluekey
> EOF
$ hg showconfig
hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey
[255]
Invalid syntax: no key
$ cat > .hg/hgrc << EOF
> =nokeyvalue
> EOF
$ hg showconfig
hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
[255]
Test hint about invalid syntax from leading white space
$ cat > .hg/hgrc << EOF
> key=value
> EOF
$ hg showconfig
hg: parse error at $TESTTMP/.hg/hgrc:1: key=value
unexpected leading whitespace
[255]
$ cat > .hg/hgrc << EOF
> [section]
> key=value
> EOF
$ hg showconfig
hg: parse error at $TESTTMP/.hg/hgrc:1: [section]
unexpected leading whitespace
[255]
Reset hgrc
$ echo > .hg/hgrc
Test case sensitive configuration
$ cat <<EOF >> $HGRCPATH
> [Section]
> KeY = Case Sensitive
> key = lower case
> EOF
$ hg showconfig Section
Section.KeY=Case Sensitive
Section.key=lower case
Test "%unset"
$ cat >> $HGRCPATH <<EOF
> [unsettest]
> local-hgrcpath = should be unset (HGRCPATH)
> %unset local-hgrcpath
>
> global = should be unset (HGRCPATH)
>
> both = should be unset (HGRCPATH)
>
> set-after-unset = should be unset (HGRCPATH)
> EOF
$ cat >> .hg/hgrc <<EOF
> [unsettest]
> local-hgrc = should be unset (.hg/hgrc)
> %unset local-hgrc
>
> %unset global
>
> both = should be unset (.hg/hgrc)
> %unset both
>
> set-after-unset = should be unset (.hg/hgrc)
> %unset set-after-unset
> set-after-unset = should be set (.hg/hgrc)
> EOF
$ hg showconfig unsettest
unsettest.set-after-unset=should be set (.hg/hgrc)
Test exit code when no config matches
$ hg config Section.idontexist
[1]