annotate tests/test-hgrc @ 11225:d6dbd5e4ee72

ui.username(): expand environment variables in username configuration value. note: expansion of config variables must be handled on a case-by-case basis because they can contain arbitrary data that may not be desirable to expand.
author Chad Dombrova <chadrik@gmail.com>
date Wed, 26 May 2010 14:03:29 -0700
parents f23f87462c18
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1473
7d66ce9895fa make readconfig take a filename instead of a file pointer as argument
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
1 #!/bin/sh
7d66ce9895fa make readconfig take a filename instead of a file pointer as argument
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
2
10043
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
3 echo "invalid" > $HGRCPATH
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
4 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
5 echo "" > $HGRCPATH
7044
e51c0f41f271 Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4659
diff changeset
6
10043
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
7 # issue1199: escaping
7044
e51c0f41f271 Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4659
diff changeset
8 hg init "foo%bar"
e51c0f41f271 Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4659
diff changeset
9 hg clone "foo%bar" foobar
e51c0f41f271 Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4659
diff changeset
10 p=`pwd`
e51c0f41f271 Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4659
diff changeset
11 cd foobar
10043
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
12 cat .hg/hgrc | sed -e "s:$p:...:"
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
13 hg paths | sed -e "s:$p:...:"
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
14 hg showconfig | sed -e "s:$p:...:"
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
15 cd ..
9470
ba75830d17a9 dispatch: catch ConfigError while constructing ui
Martin Geisler <mg@lazybytes.net>
parents: 7044
diff changeset
16
ba75830d17a9 dispatch: catch ConfigError while constructing ui
Martin Geisler <mg@lazybytes.net>
parents: 7044
diff changeset
17 # issue1829: wrong indentation
10043
e95f0f70c3fd test-hgrc: cleanup
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
18 echo '[foo]' > $HGRCPATH
9470
ba75830d17a9 dispatch: catch ConfigError while constructing ui
Martin Geisler <mg@lazybytes.net>
parents: 7044
diff changeset
19 echo ' x = y' >> $HGRCPATH
ba75830d17a9 dispatch: catch ConfigError while constructing ui
Martin Geisler <mg@lazybytes.net>
parents: 7044
diff changeset
20 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
10042
7cdd2a7db2c2 config: raise ConfigError on non-existing include files
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
21
10295
44c923eeb81d config: handle short continuations (issue1999)
Matt Mackall <mpm@selenic.com>
parents: 10042
diff changeset
22 python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
44c923eeb81d config: handle short continuations (issue1999)
Matt Mackall <mpm@selenic.com>
parents: 10042
diff changeset
23 > $HGRCPATH
44c923eeb81d config: handle short continuations (issue1999)
Matt Mackall <mpm@selenic.com>
parents: 10042
diff changeset
24 hg showconfig foo
44c923eeb81d config: handle short continuations (issue1999)
Matt Mackall <mpm@selenic.com>
parents: 10042
diff changeset
25
11224
f23f87462c18 config: expand hgrc %include paths
Chad Dombrova <chadrik@gmail.com>
parents: 10567
diff changeset
26 FAKEPATH=/path/to/nowhere
f23f87462c18 config: expand hgrc %include paths
Chad Dombrova <chadrik@gmail.com>
parents: 10567
diff changeset
27 export FAKEPATH
f23f87462c18 config: expand hgrc %include paths
Chad Dombrova <chadrik@gmail.com>
parents: 10567
diff changeset
28 echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
10042
7cdd2a7db2c2 config: raise ConfigError on non-existing include files
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
29 hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
11224
f23f87462c18 config: expand hgrc %include paths
Chad Dombrova <chadrik@gmail.com>
parents: 10567
diff changeset
30 unset FAKEPATH
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
31
11225
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
32 echo "% username expansion"
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
33 olduser=$HGUSER
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
34 unset HGUSER
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
35
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
36 FAKEUSER='John Doe'
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
37 export FAKEUSER
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
38 echo '[ui]' > $HGRCPATH
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
39 echo 'username = $FAKEUSER' >> $HGRCPATH
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
40
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
41 hg init usertest
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
42 cd usertest
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
43 touch bar
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
44 hg commit --addremove --quiet -m "added bar"
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
45 hg log --template "{author}\n"
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
46 cd ..
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
47
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
48 hg showconfig | sed -e "s:$p:...:"
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
49
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
50 unset FAKEUSER
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
51 HGUSER=$olduser
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
52 export HGUSER
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
53
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
54 # HGPLAIN
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
55 cd ..
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
56 p=`pwd`
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
57 echo "[ui]" > $HGRCPATH
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
58 echo "debug=true" >> $HGRCPATH
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
59 echo "fallbackencoding=ASCII" >> $HGRCPATH
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
60 echo "quiet=true" >> $HGRCPATH
10507
79dd96774187 ui: unset ui.slash when HGPLAIN is set
Brodie Rao <me+hg@dackz.net>
parents: 10506
diff changeset
61 echo "slash=true" >> $HGRCPATH
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
62 echo "traceback=true" >> $HGRCPATH
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
63 echo "verbose=true" >> $HGRCPATH
10567
992723445a29 ui: ignore ui.logtemplate and ui.style when HGPLAIN is set
Yuya Nishihara <yuya@tcha.org>
parents: 10507
diff changeset
64 echo "style=~/.hgstyle" >> $HGRCPATH
992723445a29 ui: ignore ui.logtemplate and ui.style when HGPLAIN is set
Yuya Nishihara <yuya@tcha.org>
parents: 10507
diff changeset
65 echo "logtemplate={node}" >> $HGRCPATH
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
66 echo "[defaults]" >> $HGRCPATH
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
67 echo "identify=-n" >> $HGRCPATH
10506
42afde35e9f7 ui: suppress aliases when HGPLAIN is set
Brodie Rao <me+hg@dackz.net>
parents: 10455
diff changeset
68 echo "[alias]" >> $HGRCPATH
42afde35e9f7 ui: suppress aliases when HGPLAIN is set
Brodie Rao <me+hg@dackz.net>
parents: 10455
diff changeset
69 echo "log=log -g" >> $HGRCPATH
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
70
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
71 echo '% customized hgrc'
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
72 hg showconfig | sed -e "s:$p:...:"
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
73
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
74 echo '% plain hgrc'
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
75 HGPLAIN=; export HGPLAIN
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
76 hg showconfig --config ui.traceback=True --debug | sed -e "s:$p:...:"