annotate tests/test-hgrc.t @ 12269:877236cdd437

add: move main part to cmdutil to make it easier to reuse
author Martin Geisler <mg@lazybytes.net>
date Mon, 13 Sep 2010 13:09:11 +0200
parents 51272b65b9b7
children c01dc9087d9a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
1 $ echo "invalid" > $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
2 $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
3 hg: parse error at $HGRCPATH:1: invalid
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
4 $ 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
5
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
6 issue1199: escaping
7044
e51c0f41f271 Escape '%' when writing to hgrc (issue1199)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 4659
diff changeset
7
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
8 $ hg init "foo%bar"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
9 $ hg clone "foo%bar" foobar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
10 updating to branch default
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
11 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
12 $ p=`pwd`
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
13 $ cd foobar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
14 $ cat .hg/hgrc | sed -e "s:$p:...:"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
15 [paths]
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
16 default = .../foo%bar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
17 $ hg paths | sed -e "s:$p:...:"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
18 default = .../foo%bar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
19 $ hg showconfig | sed -e "s:$p:...:"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
20 bundle.mainreporoot=.../foobar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
21 paths.default=.../foo%bar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
22 $ cd ..
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
23
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
24 issue1829: wrong indentation
9470
ba75830d17a9 dispatch: catch ConfigError while constructing ui
Martin Geisler <mg@lazybytes.net>
parents: 7044
diff changeset
25
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
26 $ echo '[foo]' > $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
27 $ echo ' x = y' >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
28 $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
29 hg: parse error at $HGRCPATH:2: x = y
10042
7cdd2a7db2c2 config: raise ConfigError on non-existing include files
Martin Geisler <mg@lazybytes.net>
parents: 9470
diff changeset
30
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
31 $ python -c "print '[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n'" \
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
32 > > $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
33 $ hg showconfig foo
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
34 foo.bar=a\nb\nc\nde\nfg
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
35 foo.baz=bif cb
10295
44c923eeb81d config: handle short continuations (issue1999)
Matt Mackall <mpm@selenic.com>
parents: 10042
diff changeset
36
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
37 $ FAKEPATH=/path/to/nowhere
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
38 $ export FAKEPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
39 $ echo '%include $FAKEPATH/no-such-file' > $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
40 $ hg version 2>&1 | sed -e "s|$HGRCPATH|\$HGRCPATH|"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
41 hg: parse error at $HGRCPATH:1: cannot include /path/to/nowhere/no-such-file (No such file or directory)
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
42 $ unset FAKEPATH
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
43
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
44 username expansion
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
45
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
46 $ olduser=$HGUSER
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
47 $ unset HGUSER
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
48
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
49 $ FAKEUSER='John Doe'
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
50 $ export FAKEUSER
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
51 $ echo '[ui]' > $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
52 $ echo 'username = $FAKEUSER' >> $HGRCPATH
11225
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
53
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
54 $ hg init usertest
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
55 $ cd usertest
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
56 $ touch bar
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
57 $ hg commit --addremove --quiet -m "added bar"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
58 $ hg log --template "{author}\n"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
59 John Doe
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
60 $ cd ..
11225
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
61
12109
51272b65b9b7 tests: remove useless sed in test-hgrc
Nicolas Dumazet <nicdumz.commits@gmail.com>
parents: 12014
diff changeset
62 $ hg showconfig
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
63 ui.username=$FAKEUSER
11225
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
64
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
65 $ unset FAKEUSER
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
66 $ HGUSER=$olduser
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
67 $ export HGUSER
11225
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
68
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
69 HGPLAIN
11225
d6dbd5e4ee72 ui.username(): expand environment variables in username configuration value.
Chad Dombrova <chadrik@gmail.com>
parents: 11224
diff changeset
70
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
71 $ cd ..
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
72 $ p=`pwd`
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
73 $ echo "[ui]" > $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
74 $ echo "debug=true" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
75 $ echo "fallbackencoding=ASCII" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
76 $ echo "quiet=true" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
77 $ echo "slash=true" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
78 $ echo "traceback=true" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
79 $ echo "verbose=true" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
80 $ echo "style=~/.hgstyle" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
81 $ echo "logtemplate={node}" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
82 $ echo "[defaults]" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
83 $ echo "identify=-n" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
84 $ echo "[alias]" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
85 $ echo "log=log -g" >> $HGRCPATH
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
86
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
87 customized hgrc
10455
40dfd46d098f ui: add HGPLAIN environment variable for easier scripting
Brodie Rao <me+hg@dackz.net>
parents: 10296
diff changeset
88
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
89 $ hg showconfig | sed -e "s:$p:...:"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
90 read config from: .../.hgrc
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
91 .../.hgrc:13: alias.log=log -g
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
92 .../.hgrc:11: defaults.identify=-n
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
93 .../.hgrc:2: ui.debug=true
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
94 .../.hgrc:3: ui.fallbackencoding=ASCII
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
95 .../.hgrc:4: ui.quiet=true
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
96 .../.hgrc:5: ui.slash=true
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
97 .../.hgrc:6: ui.traceback=true
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
98 .../.hgrc:7: ui.verbose=true
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
99 .../.hgrc:8: ui.style=~/.hgstyle
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
100 .../.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
101
12014
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
102 plain hgrc
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
103
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
104 $ HGPLAIN=; export HGPLAIN
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
105 $ hg showconfig --config ui.traceback=True --debug | sed -e "s:$p:...:"
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
106 read config from: .../.hgrc
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
107 none: ui.traceback=True
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
108 none: ui.verbose=False
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
109 none: ui.debug=True
8508dd698c02 tests: unify test-hgrc
Brodie Rao <brodie@bitheap.org>
parents: 11225
diff changeset
110 none: ui.quiet=False