Mercurial > hg
annotate tests/test-hgrc.t @ 13955:86b5cc1e8be8 stable
help config: explain that config files do not exist by default
Inspired by critique given on StackOverflow where a user writes:
I can have a good guess at what "%USERPROFILE%" might signify but
none of the files listed in the "hg help config" output exist after
running the installer. Previous experience would suggest that
missing files mean something somewhere has gone seriously wrong.
http://stackoverflow.com/questions/2329023/2351139#2351139
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Mon, 18 Apr 2011 13:57:22 +0200 |
parents | 14853ca7e11b |
children | 1bb2a56a9d73 |
rev | line source |
---|---|
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
1 Use hgrc within $TESTTMP |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
2 |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
3 $ HGRCPATH=`pwd`/hgrc |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
4 $ export HGRCPATH |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
5 |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
6 Basic syntax error |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
7 |
12014 | 8 $ echo "invalid" > $HGRCPATH |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
9 $ hg version |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
10 hg: parse error at $TESTTMP/hgrc:1: invalid |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
11 [255] |
12014 | 12 $ echo "" > $HGRCPATH |
1473
7d66ce9895fa
make readconfig take a filename instead of a file pointer as argument
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
13 |
12399
4fee1fd3de9a
tests: added a short description to issue numbers
Martin Geisler <mg@aragost.com>
parents:
12376
diff
changeset
|
14 Issue1199: Can't use '%' in hgrc (eg url encoded username) |
7044
e51c0f41f271
Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
4659
diff
changeset
|
15 |
12014 | 16 $ hg init "foo%bar" |
17 $ hg clone "foo%bar" foobar | |
18 updating to branch default | |
19 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
20 $ cd foobar | |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
21 $ cat .hg/hgrc |
12014 | 22 [paths] |
12376
97ffc68f71d3
tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents:
12375
diff
changeset
|
23 default = */foo%bar (glob) |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
24 $ hg paths |
12376
97ffc68f71d3
tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents:
12375
diff
changeset
|
25 default = */foo%bar (glob) |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
26 $ hg showconfig |
12376
97ffc68f71d3
tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents:
12375
diff
changeset
|
27 bundle.mainreporoot=*/foobar (glob) |
97ffc68f71d3
tests: add glob matching for unified tests
Brodie Rao <brodie@bitheap.org>
parents:
12375
diff
changeset
|
28 paths.default=*/foo%bar (glob) |
12014 | 29 $ cd .. |
30 | |
31 issue1829: wrong indentation | |
9470
ba75830d17a9
dispatch: catch ConfigError while constructing ui
Martin Geisler <mg@lazybytes.net>
parents:
7044
diff
changeset
|
32 |
12014 | 33 $ echo '[foo]' > $HGRCPATH |
34 $ echo ' x = y' >> $HGRCPATH | |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
35 $ hg version |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
36 hg: parse error at $TESTTMP/hgrc:2: x = y |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
37 [255] |
10042
7cdd2a7db2c2
config: raise ConfigError on non-existing include files
Martin Geisler <mg@lazybytes.net>
parents:
9470
diff
changeset
|
38 |
12014 | 39 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \ |
40 > > $HGRCPATH | |
41 $ hg showconfig foo | |
42 foo.bar=a\nb\nc\nde\nfg | |
43 foo.baz=bif cb | |
10295
44c923eeb81d
config: handle short continuations (issue1999)
Matt Mackall <mpm@selenic.com>
parents:
10042
diff
changeset
|
44 |
12014 | 45 $ FAKEPATH=/path/to/nowhere |
46 $ export FAKEPATH | |
47 $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH | |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
48 $ hg version |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
49 hg: parse error at $TESTTMP/hgrc:1: cannot include /path/to/nowhere/no-such-file (No such file or directory) |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
50 [255] |
12014 | 51 $ unset FAKEPATH |
10455
40dfd46d098f
ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents:
10296
diff
changeset
|
52 |
12014 | 53 username expansion |
54 | |
55 $ olduser=$HGUSER | |
56 $ unset HGUSER | |
57 | |
58 $ FAKEUSER='John Doe' | |
59 $ export FAKEUSER | |
60 $ echo '[ui]' > $HGRCPATH | |
61 $ echo 'username = $FAKEUSER' >> $HGRCPATH | |
11225
d6dbd5e4ee72
ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents:
11224
diff
changeset
|
62 |
12014 | 63 $ hg init usertest |
64 $ cd usertest | |
65 $ touch bar | |
66 $ hg commit --addremove --quiet -m "added bar" | |
67 $ hg log --template "{author}\n" | |
68 John Doe | |
69 $ cd .. | |
11225
d6dbd5e4ee72
ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents:
11224
diff
changeset
|
70 |
12109
51272b65b9b7
tests: remove useless sed in test-hgrc
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents:
12014
diff
changeset
|
71 $ hg showconfig |
12014 | 72 ui.username=$FAKEUSER |
11225
d6dbd5e4ee72
ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents:
11224
diff
changeset
|
73 |
12014 | 74 $ unset FAKEUSER |
75 $ HGUSER=$olduser | |
76 $ export HGUSER | |
11225
d6dbd5e4ee72
ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents:
11224
diff
changeset
|
77 |
12697
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
78 showconfig with multiple arguments |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
79 |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
80 $ echo "[alias]" > $HGRCPATH |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
81 $ echo "log = log -g" >> $HGRCPATH |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
82 $ echo "[defaults]" >> $HGRCPATH |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
83 $ echo "identify = -n" >> $HGRCPATH |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
84 $ hg showconfig alias defaults |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
85 alias.log=log -g |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
86 defaults.identify=-n |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
87 $ hg showconfig alias defaults.identify |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
88 abort: only one config item permitted |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
89 [255] |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
90 $ hg showconfig alias.log defaults.identify |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
91 abort: only one config item permitted |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
92 [255] |
14853ca7e11b
showconfig: don't accept multiple sections and one config item
Brodie Rao <brodie@bitheap.org>
parents:
12640
diff
changeset
|
93 |
12014 | 94 HGPLAIN |
11225
d6dbd5e4ee72
ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents:
11224
diff
changeset
|
95 |
12014 | 96 $ cd .. |
97 $ p=`pwd` | |
98 $ echo "[ui]" > $HGRCPATH | |
99 $ echo "debug=true" >> $HGRCPATH | |
100 $ echo "fallbackencoding=ASCII" >> $HGRCPATH | |
101 $ echo "quiet=true" >> $HGRCPATH | |
102 $ echo "slash=true" >> $HGRCPATH | |
103 $ echo "traceback=true" >> $HGRCPATH | |
104 $ echo "verbose=true" >> $HGRCPATH | |
105 $ echo "style=~/.hgstyle" >> $HGRCPATH | |
106 $ echo "logtemplate={node}" >> $HGRCPATH | |
107 $ echo "[defaults]" >> $HGRCPATH | |
108 $ echo "identify=-n" >> $HGRCPATH | |
109 $ echo "[alias]" >> $HGRCPATH | |
110 $ echo "log=log -g" >> $HGRCPATH | |
111 | |
112 customized hgrc | |
10455
40dfd46d098f
ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents:
10296
diff
changeset
|
113 |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
114 $ hg showconfig |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
115 read config from: $TESTTMP/hgrc |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
116 $TESTTMP/hgrc:13: alias.log=log -g |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
117 $TESTTMP/hgrc:11: defaults.identify=-n |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
118 $TESTTMP/hgrc:2: ui.debug=true |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
119 $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
120 $TESTTMP/hgrc:4: ui.quiet=true |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
121 $TESTTMP/hgrc:5: ui.slash=true |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
122 $TESTTMP/hgrc:6: ui.traceback=true |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
123 $TESTTMP/hgrc:7: ui.verbose=true |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
124 $TESTTMP/hgrc:8: ui.style=~/.hgstyle |
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
125 $TESTTMP/hgrc:9: ui.logtemplate={node} |
10455
40dfd46d098f
ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents:
10296
diff
changeset
|
126 |
12014 | 127 plain hgrc |
128 | |
129 $ HGPLAIN=; export HGPLAIN | |
12366
c01dc9087d9a
tests: drop a bunch of sed calls from unified tests
Matt Mackall <mpm@selenic.com>
parents:
12109
diff
changeset
|
130 $ hg showconfig --config ui.traceback=True --debug |
12640
6cc4b14fb76b
tests: remove redundant globs
Mads Kiilerich <mads@kiilerich.com>
parents:
12399
diff
changeset
|
131 read config from: $TESTTMP/hgrc |
12014 | 132 none: ui.traceback=True |
133 none: ui.verbose=False | |
134 none: ui.debug=True | |
135 none: ui.quiet=False |