Show More
@@ -1,249 +1,249 b'' | |||
|
1 | hide outer repo | |
|
2 | $ hg init | |
|
3 | ||
|
4 | 1 | Use hgrc within $TESTTMP |
|
5 | 2 | |
|
6 | 3 | $ HGRCPATH=`pwd`/hgrc |
|
7 | 4 | $ export HGRCPATH |
|
8 | 5 | |
|
6 | hide outer repo | |
|
7 | $ hg init | |
|
8 | ||
|
9 | 9 | Use an alternate var for scribbling on hgrc to keep check-code from |
|
10 | 10 | complaining about the important settings we may be overwriting: |
|
11 | 11 | |
|
12 | 12 | $ HGRC=`pwd`/hgrc |
|
13 | 13 | $ export HGRC |
|
14 | 14 | |
|
15 | 15 | Basic syntax error |
|
16 | 16 | |
|
17 | 17 | $ echo "invalid" > $HGRC |
|
18 | 18 | $ hg version |
|
19 | 19 | hg: parse error at $TESTTMP/hgrc:1: invalid |
|
20 | 20 | [255] |
|
21 | 21 | $ echo "" > $HGRC |
|
22 | 22 | |
|
23 | 23 | Issue1199: Can't use '%' in hgrc (eg url encoded username) |
|
24 | 24 | |
|
25 | 25 | $ hg init "foo%bar" |
|
26 | 26 | $ hg clone "foo%bar" foobar |
|
27 | 27 | updating to branch default |
|
28 | 28 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
29 | 29 | $ cd foobar |
|
30 | 30 | $ cat .hg/hgrc |
|
31 | 31 | # example repository config (see 'hg help config' for more info) |
|
32 | 32 | [paths] |
|
33 | 33 | default = $TESTTMP/foo%bar |
|
34 | 34 | |
|
35 | 35 | # path aliases to other clones of this repo in URLs or filesystem paths |
|
36 | 36 | # (see 'hg help config.paths' for more info) |
|
37 | 37 | # |
|
38 | 38 | # default:pushurl = ssh://jdoe@example.net/hg/jdoes-fork |
|
39 | 39 | # my-fork = ssh://jdoe@example.net/hg/jdoes-fork |
|
40 | 40 | # my-clone = /home/jdoe/jdoes-clone |
|
41 | 41 | |
|
42 | 42 | [ui] |
|
43 | 43 | # name and email (local to this repository, optional), e.g. |
|
44 | 44 | # username = Jane Doe <jdoe@example.com> |
|
45 | 45 | $ hg paths |
|
46 | 46 | default = $TESTTMP/foo%bar |
|
47 | 47 | $ hg showconfig |
|
48 | 48 | bundle.mainreporoot=$TESTTMP/foobar |
|
49 | 49 | paths.default=$TESTTMP/foo%bar |
|
50 | 50 | $ cd .. |
|
51 | 51 | |
|
52 | 52 | issue1829: wrong indentation |
|
53 | 53 | |
|
54 | 54 | $ echo '[foo]' > $HGRC |
|
55 | 55 | $ echo ' x = y' >> $HGRC |
|
56 | 56 | $ hg version |
|
57 | 57 | hg: parse error at $TESTTMP/hgrc:2: x = y |
|
58 | 58 | unexpected leading whitespace |
|
59 | 59 | [255] |
|
60 | 60 | |
|
61 | 61 | $ $PYTHON -c "from __future__ import print_function; print('[foo]\nbar = a\n b\n c \n de\n fg \nbaz = bif cb \n')" \ |
|
62 | 62 | > > $HGRC |
|
63 | 63 | $ hg showconfig foo |
|
64 | 64 | foo.bar=a\nb\nc\nde\nfg |
|
65 | 65 | foo.baz=bif cb |
|
66 | 66 | |
|
67 | 67 | $ FAKEPATH=/path/to/nowhere |
|
68 | 68 | $ export FAKEPATH |
|
69 | 69 | $ echo '%include $FAKEPATH/no-such-file' > $HGRC |
|
70 | 70 | $ hg version |
|
71 | 71 | Mercurial Distributed SCM (version *) (glob) |
|
72 | 72 | (see https://mercurial-scm.org for more information) |
|
73 | 73 | |
|
74 | 74 | Copyright (C) 2005-* Matt Mackall and others (glob) |
|
75 | 75 | This is free software; see the source for copying conditions. There is NO |
|
76 | 76 | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
77 | 77 | $ unset FAKEPATH |
|
78 | 78 | |
|
79 | 79 | make sure global options given on the cmdline take precedence |
|
80 | 80 | |
|
81 | 81 | $ hg showconfig --config ui.verbose=True --quiet |
|
82 | 82 | bundle.mainreporoot=$TESTTMP |
|
83 | 83 | ui.verbose=False |
|
84 | 84 | ui.debug=False |
|
85 | 85 | ui.quiet=True |
|
86 | 86 | |
|
87 | 87 | $ touch foobar/untracked |
|
88 | 88 | $ cat >> foobar/.hg/hgrc <<EOF |
|
89 | 89 | > [ui] |
|
90 | 90 | > verbose=True |
|
91 | 91 | > EOF |
|
92 | 92 | $ hg -R foobar st -q |
|
93 | 93 | |
|
94 | 94 | username expansion |
|
95 | 95 | |
|
96 | 96 | $ olduser=$HGUSER |
|
97 | 97 | $ unset HGUSER |
|
98 | 98 | |
|
99 | 99 | $ FAKEUSER='John Doe' |
|
100 | 100 | $ export FAKEUSER |
|
101 | 101 | $ echo '[ui]' > $HGRC |
|
102 | 102 | $ echo 'username = $FAKEUSER' >> $HGRC |
|
103 | 103 | |
|
104 | 104 | $ hg init usertest |
|
105 | 105 | $ cd usertest |
|
106 | 106 | $ touch bar |
|
107 | 107 | $ hg commit --addremove --quiet -m "added bar" |
|
108 | 108 | $ hg log --template "{author}\n" |
|
109 | 109 | John Doe |
|
110 | 110 | $ cd .. |
|
111 | 111 | |
|
112 | 112 | $ hg showconfig |
|
113 | 113 | bundle.mainreporoot=$TESTTMP |
|
114 | 114 | ui.username=$FAKEUSER |
|
115 | 115 | |
|
116 | 116 | $ unset FAKEUSER |
|
117 | 117 | $ HGUSER=$olduser |
|
118 | 118 | $ export HGUSER |
|
119 | 119 | |
|
120 | 120 | showconfig with multiple arguments |
|
121 | 121 | |
|
122 | 122 | $ echo "[alias]" > $HGRC |
|
123 | 123 | $ echo "log = log -g" >> $HGRC |
|
124 | 124 | $ echo "[defaults]" >> $HGRC |
|
125 | 125 | $ echo "identify = -n" >> $HGRC |
|
126 | 126 | $ hg showconfig alias defaults |
|
127 | 127 | alias.log=log -g |
|
128 | 128 | defaults.identify=-n |
|
129 | 129 | $ hg showconfig alias alias |
|
130 | 130 | alias.log=log -g |
|
131 | 131 | $ hg showconfig alias.log alias.log |
|
132 | 132 | alias.log=log -g |
|
133 | 133 | $ hg showconfig alias defaults.identify |
|
134 | 134 | alias.log=log -g |
|
135 | 135 | defaults.identify=-n |
|
136 | 136 | $ hg showconfig alias.log defaults.identify |
|
137 | 137 | alias.log=log -g |
|
138 | 138 | defaults.identify=-n |
|
139 | 139 | |
|
140 | 140 | HGPLAIN |
|
141 | 141 | |
|
142 | 142 | $ echo "[ui]" > $HGRC |
|
143 | 143 | $ echo "debug=true" >> $HGRC |
|
144 | 144 | $ echo "fallbackencoding=ASCII" >> $HGRC |
|
145 | 145 | $ echo "quiet=true" >> $HGRC |
|
146 | 146 | $ echo "slash=true" >> $HGRC |
|
147 | 147 | $ echo "traceback=true" >> $HGRC |
|
148 | 148 | $ echo "verbose=true" >> $HGRC |
|
149 | 149 | $ echo "style=~/.hgstyle" >> $HGRC |
|
150 | 150 | $ echo "logtemplate={node}" >> $HGRC |
|
151 | 151 | $ echo "[defaults]" >> $HGRC |
|
152 | 152 | $ echo "identify=-n" >> $HGRC |
|
153 | 153 | $ echo "[alias]" >> $HGRC |
|
154 | 154 | $ echo "log=log -g" >> $HGRC |
|
155 | 155 | |
|
156 | 156 | customized hgrc |
|
157 | 157 | |
|
158 | 158 | $ hg showconfig |
|
159 | 159 | read config from: $TESTTMP/hgrc |
|
160 | 160 | $TESTTMP/hgrc:13: alias.log=log -g |
|
161 | 161 | repo: bundle.mainreporoot=$TESTTMP |
|
162 | 162 | $TESTTMP/hgrc:11: defaults.identify=-n |
|
163 | 163 | $TESTTMP/hgrc:2: ui.debug=true |
|
164 | 164 | $TESTTMP/hgrc:3: ui.fallbackencoding=ASCII |
|
165 | 165 | $TESTTMP/hgrc:4: ui.quiet=true |
|
166 | 166 | $TESTTMP/hgrc:5: ui.slash=true |
|
167 | 167 | $TESTTMP/hgrc:6: ui.traceback=true |
|
168 | 168 | $TESTTMP/hgrc:7: ui.verbose=true |
|
169 | 169 | $TESTTMP/hgrc:8: ui.style=~/.hgstyle |
|
170 | 170 | $TESTTMP/hgrc:9: ui.logtemplate={node} |
|
171 | 171 | |
|
172 | 172 | plain hgrc |
|
173 | 173 | |
|
174 | 174 | $ HGPLAIN=; export HGPLAIN |
|
175 | 175 | $ hg showconfig --config ui.traceback=True --debug |
|
176 | 176 | read config from: $TESTTMP/hgrc |
|
177 | 177 | repo: bundle.mainreporoot=$TESTTMP |
|
178 | 178 | --config: ui.traceback=True |
|
179 | 179 | --verbose: ui.verbose=False |
|
180 | 180 | --debug: ui.debug=True |
|
181 | 181 | --quiet: ui.quiet=False |
|
182 | 182 | |
|
183 | 183 | with environment variables |
|
184 | 184 | |
|
185 | 185 | $ PAGER=p1 EDITOR=e1 VISUAL=e2 hg showconfig --debug |
|
186 | 186 | set config by: $EDITOR |
|
187 | 187 | set config by: $VISUAL |
|
188 | 188 | set config by: $PAGER |
|
189 | 189 | read config from: $TESTTMP/hgrc |
|
190 | 190 | repo: bundle.mainreporoot=$TESTTMP |
|
191 | 191 | $PAGER: pager.pager=p1 |
|
192 | 192 | $VISUAL: ui.editor=e2 |
|
193 | 193 | --verbose: ui.verbose=False |
|
194 | 194 | --debug: ui.debug=True |
|
195 | 195 | --quiet: ui.quiet=False |
|
196 | 196 | |
|
197 | 197 | plain mode with exceptions |
|
198 | 198 | |
|
199 | 199 | $ cat > plain.py <<EOF |
|
200 | 200 | > from mercurial import commands, extensions |
|
201 | 201 | > def _config(orig, ui, repo, *values, **opts): |
|
202 | 202 | > ui.write('plain: %r\n' % ui.plain()) |
|
203 | 203 | > return orig(ui, repo, *values, **opts) |
|
204 | 204 | > def uisetup(ui): |
|
205 | 205 | > extensions.wrapcommand(commands.table, 'config', _config) |
|
206 | 206 | > EOF |
|
207 | 207 | $ echo "[extensions]" >> $HGRC |
|
208 | 208 | $ echo "plain=./plain.py" >> $HGRC |
|
209 | 209 | $ HGPLAINEXCEPT=; export HGPLAINEXCEPT |
|
210 | 210 | $ hg showconfig --config ui.traceback=True --debug |
|
211 | 211 | plain: True |
|
212 | 212 | read config from: $TESTTMP/hgrc |
|
213 | 213 | repo: bundle.mainreporoot=$TESTTMP |
|
214 | 214 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
215 | 215 | --config: ui.traceback=True |
|
216 | 216 | --verbose: ui.verbose=False |
|
217 | 217 | --debug: ui.debug=True |
|
218 | 218 | --quiet: ui.quiet=False |
|
219 | 219 | $ unset HGPLAIN |
|
220 | 220 | $ hg showconfig --config ui.traceback=True --debug |
|
221 | 221 | plain: True |
|
222 | 222 | read config from: $TESTTMP/hgrc |
|
223 | 223 | repo: bundle.mainreporoot=$TESTTMP |
|
224 | 224 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
225 | 225 | --config: ui.traceback=True |
|
226 | 226 | --verbose: ui.verbose=False |
|
227 | 227 | --debug: ui.debug=True |
|
228 | 228 | --quiet: ui.quiet=False |
|
229 | 229 | $ HGPLAINEXCEPT=i18n; export HGPLAINEXCEPT |
|
230 | 230 | $ hg showconfig --config ui.traceback=True --debug |
|
231 | 231 | plain: True |
|
232 | 232 | read config from: $TESTTMP/hgrc |
|
233 | 233 | repo: bundle.mainreporoot=$TESTTMP |
|
234 | 234 | $TESTTMP/hgrc:15: extensions.plain=./plain.py |
|
235 | 235 | --config: ui.traceback=True |
|
236 | 236 | --verbose: ui.verbose=False |
|
237 | 237 | --debug: ui.debug=True |
|
238 | 238 | --quiet: ui.quiet=False |
|
239 | 239 | |
|
240 | 240 | source of paths is not mangled |
|
241 | 241 | |
|
242 | 242 | $ cat >> $HGRCPATH <<EOF |
|
243 | 243 | > [paths] |
|
244 | 244 | > foo = bar |
|
245 | 245 | > EOF |
|
246 | 246 | $ hg showconfig --debug paths |
|
247 | 247 | plain: True |
|
248 | 248 | read config from: $TESTTMP/hgrc |
|
249 | 249 | $TESTTMP/hgrc:17: paths.foo=$TESTTMP/bar |
General Comments 0
You need to be logged in to leave comments.
Login now