##// END OF EJS Templates
py3: byte-stringify test-config.t and test-config-env.py
Yuya Nishihara -
r36748:a22915ed default
parent child Browse files
Show More
@@ -1,387 +1,389 b''
1 1 test-abort-checkin.t
2 2 test-add.t
3 3 test-addremove-similar.t
4 4 test-addremove.t
5 5 test-amend-subrepo.t
6 6 test-ancestor.py
7 7 test-annotate.py
8 8 test-annotate.t
9 9 test-archive-symlinks.t
10 10 test-atomictempfile.py
11 11 test-audit-path.t
12 12 test-audit-subrepo.t
13 13 test-automv.t
14 14 test-backout.t
15 15 test-backwards-remove.t
16 16 test-basic.t
17 17 test-bheads.t
18 18 test-bisect2.t
19 19 test-bookmarks-current.t
20 20 test-bookmarks-merge.t
21 21 test-bookmarks-rebase.t
22 22 test-bookmarks-strip.t
23 23 test-bookmarks.t
24 24 test-branch-option.t
25 25 test-branch-tag-confict.t
26 26 test-branches.t
27 27 test-bundle-phases.t
28 28 test-bundle-type.t
29 29 test-bundle-vs-outgoing.t
30 30 test-bundle2-multiple-changegroups.t
31 31 test-cappedreader.py
32 32 test-casecollision.t
33 33 test-cat.t
34 34 test-censor.t
35 35 test-changelog-exec.t
36 36 test-check-commit.t
37 37 test-check-execute.t
38 38 test-check-module-imports.t
39 39 test-check-pyflakes.t
40 40 test-check-pylint.t
41 41 test-check-shbang.t
42 42 test-children.t
43 43 test-clone-pull-corruption.t
44 44 test-clone-r.t
45 45 test-clone-update-order.t
46 46 test-command-template.t
47 47 test-commit-amend.t
48 48 test-commit-unresolved.t
49 49 test-commit.t
50 50 test-completion.t
51 test-config-env.py
52 test-config.t
51 53 test-conflict.t
52 54 test-confused-revert.t
53 55 test-contrib-check-code.t
54 56 test-contrib-check-commit.t
55 57 test-convert-authormap.t
56 58 test-convert-clonebranches.t
57 59 test-convert-datesort.t
58 60 test-convert-filemap.t
59 61 test-convert-hg-sink.t
60 62 test-convert-hg-source.t
61 63 test-convert-hg-startrev.t
62 64 test-copy-move-merge.t
63 65 test-copy.t
64 66 test-copytrace-heuristics.t
65 67 test-debugbuilddag.t
66 68 test-debugbundle.t
67 69 test-debugextensions.t
68 70 test-debugindexdot.t
69 71 test-debugrename.t
70 72 test-diff-binary-file.t
71 73 test-diff-change.t
72 74 test-diff-copy-depth.t
73 75 test-diff-hashes.t
74 76 test-diff-issue2761.t
75 77 test-diff-newlines.t
76 78 test-diff-reverse.t
77 79 test-diff-subdir.t
78 80 test-diffdir.t
79 81 test-directaccess.t
80 82 test-dirstate-backup.t
81 83 test-dirstate-nonnormalset.t
82 84 test-doctest.py
83 85 test-double-merge.t
84 86 test-drawdag.t
85 87 test-duplicateoptions.py
86 88 test-empty-dir.t
87 89 test-empty-file.t
88 90 test-empty-group.t
89 91 test-empty.t
90 92 test-encode.t
91 93 test-encoding-func.py
92 94 test-encoding.t
93 95 test-eol-add.t
94 96 test-eol-clone.t
95 97 test-eol-hook.t
96 98 test-eol-tag.t
97 99 test-eol-update.t
98 100 test-excessive-merge.t
99 101 test-exchange-obsmarkers-case-A1.t
100 102 test-exchange-obsmarkers-case-A2.t
101 103 test-exchange-obsmarkers-case-A3.t
102 104 test-exchange-obsmarkers-case-A4.t
103 105 test-exchange-obsmarkers-case-A5.t
104 106 test-exchange-obsmarkers-case-A6.t
105 107 test-exchange-obsmarkers-case-A7.t
106 108 test-exchange-obsmarkers-case-B1.t
107 109 test-exchange-obsmarkers-case-B2.t
108 110 test-exchange-obsmarkers-case-B3.t
109 111 test-exchange-obsmarkers-case-B4.t
110 112 test-exchange-obsmarkers-case-B5.t
111 113 test-exchange-obsmarkers-case-B6.t
112 114 test-exchange-obsmarkers-case-B7.t
113 115 test-exchange-obsmarkers-case-C1.t
114 116 test-exchange-obsmarkers-case-C2.t
115 117 test-exchange-obsmarkers-case-C3.t
116 118 test-exchange-obsmarkers-case-C4.t
117 119 test-exchange-obsmarkers-case-D1.t
118 120 test-exchange-obsmarkers-case-D2.t
119 121 test-exchange-obsmarkers-case-D3.t
120 122 test-exchange-obsmarkers-case-D4.t
121 123 test-execute-bit.t
122 124 test-extdiff.t
123 125 test-extra-filelog-entry.t
124 126 test-filebranch.t
125 127 test-fileset-generated.t
126 128 test-flags.t
127 129 test-generaldelta.t
128 130 test-getbundle.t
129 131 test-git-export.t
130 132 test-glog-topological.t
131 133 test-gpg.t
132 134 test-graft.t
133 135 test-hghave.t
134 136 test-hgignore.t
135 137 test-hgk.t
136 138 test-hgweb-bundle.t
137 139 test-hgweb-descend-empties.t
138 140 test-hgweb-removed.t
139 141 test-histedit-arguments.t
140 142 test-histedit-base.t
141 143 test-histedit-bookmark-motion.t
142 144 test-histedit-commute.t
143 145 test-histedit-drop.t
144 146 test-histedit-edit.t
145 147 test-histedit-fold-non-commute.t
146 148 test-histedit-fold.t
147 149 test-histedit-no-change.t
148 150 test-histedit-non-commute-abort.t
149 151 test-histedit-non-commute.t
150 152 test-histedit-obsolete.t
151 153 test-histedit-outgoing.t
152 154 test-histedit-templates.t
153 155 test-http-branchmap.t
154 156 test-http-bundle1.t
155 157 test-http-clone-r.t
156 158 test-identify.t
157 159 test-import-unknown.t
158 160 test-imports-checker.t
159 161 test-inherit-mode.t
160 162 test-issue1089.t
161 163 test-issue1102.t
162 164 test-issue1175.t
163 165 test-issue1306.t
164 166 test-issue1438.t
165 167 test-issue1502.t
166 168 test-issue1802.t
167 169 test-issue1877.t
168 170 test-issue1993.t
169 171 test-issue2137.t
170 172 test-issue3084.t
171 173 test-issue4074.t
172 174 test-issue522.t
173 175 test-issue586.t
174 176 test-issue612.t
175 177 test-issue619.t
176 178 test-issue672.t
177 179 test-issue842.t
178 180 test-journal-exists.t
179 181 test-largefiles-cache.t
180 182 test-largefiles-misc.t
181 183 test-largefiles-small-disk.t
182 184 test-locate.t
183 185 test-lock-badness.t
184 186 test-log.t
185 187 test-logexchange.t
186 188 test-lrucachedict.py
187 189 test-mactext.t
188 190 test-manifest-merging.t
189 191 test-manifest.py
190 192 test-manifest.t
191 193 test-match.py
192 194 test-mdiff.py
193 195 test-merge-closedheads.t
194 196 test-merge-commit.t
195 197 test-merge-criss-cross.t
196 198 test-merge-default.t
197 199 test-merge-internal-tools-pattern.t
198 200 test-merge-local.t
199 201 test-merge-remove.t
200 202 test-merge-revert.t
201 203 test-merge-revert2.t
202 204 test-merge-subrepos.t
203 205 test-merge-symlinks.t
204 206 test-merge-types.t
205 207 test-merge1.t
206 208 test-merge10.t
207 209 test-merge2.t
208 210 test-merge4.t
209 211 test-merge5.t
210 212 test-merge6.t
211 213 test-merge7.t
212 214 test-merge8.t
213 215 test-merge9.t
214 216 test-mq-git.t
215 217 test-mq-header-date.t
216 218 test-mq-header-from.t
217 219 test-mq-pull-from-bundle.t
218 220 test-mq-qdiff.t
219 221 test-mq-qfold.t
220 222 test-mq-qgoto.t
221 223 test-mq-qimport-fail-cleanup.t
222 224 test-mq-qpush-exact.t
223 225 test-mq-qqueue.t
224 226 test-mq-qrefresh-replace-log-message.t
225 227 test-mq-qrefresh.t
226 228 test-mq-qrename.t
227 229 test-mq-qsave.t
228 230 test-mq-safety.t
229 231 test-mq-symlinks.t
230 232 test-mv-cp-st-diff.t
231 233 test-narrow-archive.t
232 234 test-narrow-clone-no-ellipsis.t
233 235 test-narrow-clone-nonlinear.t
234 236 test-narrow-clone.t
235 237 test-narrow-commit.t
236 238 test-narrow-copies.t
237 239 test-narrow-debugcommands.t
238 240 test-narrow-debugrebuilddirstate.t
239 241 test-narrow-exchange-merges.t
240 242 test-narrow-exchange.t
241 243 test-narrow-expanddirstate.t
242 244 test-narrow-merge.t
243 245 test-narrow-patch.t
244 246 test-narrow-patterns.t
245 247 test-narrow-pull.t
246 248 test-narrow-rebase.t
247 249 test-narrow-shallow-merges.t
248 250 test-narrow-shallow.t
249 251 test-narrow-strip.t
250 252 test-narrow-update.t
251 253 test-nested-repo.t
252 254 test-newbranch.t
253 255 test-obshistory.t
254 256 test-obsmarker-template.t
255 257 test-obsmarkers-effectflag.t
256 258 test-obsolete-bundle-strip.t
257 259 test-obsolete-changeset-exchange.t
258 260 test-obsolete-checkheads.t
259 261 test-obsolete-distributed.t
260 262 test-obsolete-tag-cache.t
261 263 test-parents.t
262 264 test-pathconflicts-merge.t
263 265 test-pathconflicts-update.t
264 266 test-pending.t
265 267 test-permissions.t
266 268 test-phases.t
267 269 test-pull-branch.t
268 270 test-pull-http.t
269 271 test-pull-permission.t
270 272 test-pull-pull-corruption.t
271 273 test-pull-r.t
272 274 test-pull-update.t
273 275 test-purge.t
274 276 test-push-checkheads-partial-C1.t
275 277 test-push-checkheads-partial-C2.t
276 278 test-push-checkheads-partial-C3.t
277 279 test-push-checkheads-partial-C4.t
278 280 test-push-checkheads-pruned-B1.t
279 281 test-push-checkheads-pruned-B2.t
280 282 test-push-checkheads-pruned-B3.t
281 283 test-push-checkheads-pruned-B4.t
282 284 test-push-checkheads-pruned-B5.t
283 285 test-push-checkheads-pruned-B6.t
284 286 test-push-checkheads-pruned-B7.t
285 287 test-push-checkheads-pruned-B8.t
286 288 test-push-checkheads-superceed-A1.t
287 289 test-push-checkheads-superceed-A2.t
288 290 test-push-checkheads-superceed-A3.t
289 291 test-push-checkheads-superceed-A4.t
290 292 test-push-checkheads-superceed-A5.t
291 293 test-push-checkheads-superceed-A6.t
292 294 test-push-checkheads-superceed-A7.t
293 295 test-push-checkheads-superceed-A8.t
294 296 test-push-checkheads-unpushed-D1.t
295 297 test-push-checkheads-unpushed-D2.t
296 298 test-push-checkheads-unpushed-D3.t
297 299 test-push-checkheads-unpushed-D4.t
298 300 test-push-checkheads-unpushed-D5.t
299 301 test-push-checkheads-unpushed-D6.t
300 302 test-push-checkheads-unpushed-D7.t
301 303 test-push-http.t
302 304 test-push-warn.t
303 305 test-pushvars.t
304 306 test-rebase-abort.t
305 307 test-rebase-base-flag.t
306 308 test-rebase-bookmarks.t
307 309 test-rebase-brute-force.t
308 310 test-rebase-cache.t
309 311 test-rebase-check-restore.t
310 312 test-rebase-collapse.t
311 313 test-rebase-dest.t
312 314 test-rebase-detach.t
313 315 test-rebase-emptycommit.t
314 316 test-rebase-inmemory.t
315 317 test-rebase-interruptions.t
316 318 test-rebase-issue-noparam-single-rev.t
317 319 test-rebase-legacy.t
318 320 test-rebase-mq-skip.t
319 321 test-rebase-named-branches.t
320 322 test-rebase-newancestor.t
321 323 test-rebase-obsolete.t
322 324 test-rebase-parameters.t
323 325 test-rebase-partial.t
324 326 test-rebase-pull.t
325 327 test-rebase-rename.t
326 328 test-rebase-scenario-global.t
327 329 test-rebase-templates.t
328 330 test-rebase-transaction.t
329 331 test-record.t
330 332 test-relink.t
331 333 test-remove.t
332 334 test-rename-after-merge.t
333 335 test-rename-dir-merge.t
334 336 test-rename-merge1.t
335 337 test-rename.t
336 338 test-repair-strip.t
337 339 test-repo-compengines.t
338 340 test-resolve.t
339 341 test-revert-flags.t
340 342 test-revert-unknown.t
341 343 test-revlog-ancestry.py
342 344 test-revlog-group-emptyiter.t
343 345 test-revlog-mmapindex.t
344 346 test-revlog-packentry.t
345 347 test-revset-dirstate-parents.t
346 348 test-revset-outgoing.t
347 349 test-run-tests.py
348 350 test-schemes.t
349 351 test-serve.t
350 352 test-share.t
351 353 test-show-stack.t
352 354 test-show-work.t
353 355 test-show.t
354 356 test-simple-update.t
355 357 test-single-head.t
356 358 test-sparse-clear.t
357 359 test-sparse-merges.t
358 360 test-sparse-requirement.t
359 361 test-sparse-verbose-json.t
360 362 test-ssh-clone-r.t
361 363 test-ssh-proto.t
362 364 test-sshserver.py
363 365 test-status-rev.t
364 366 test-status-terse.t
365 367 test-strip-cross.t
366 368 test-strip.t
367 369 test-subrepo-deep-nested-change.t
368 370 test-subrepo.t
369 371 test-symlinks.t
370 372 test-treemanifest.t
371 373 test-unamend.t
372 374 test-uncommit.t
373 375 test-unified-test.t
374 376 test-unrelated-pull.t
375 377 test-up-local-change.t
376 378 test-update-branches.t
377 379 test-update-dest.t
378 380 test-update-issue1456.t
379 381 test-update-names.t
380 382 test-update-reverse.t
381 383 test-upgrade-repo.t
382 384 test-url-rev.t
383 385 test-username-newline.t
384 386 test-verify.t
385 387 test-websub.t
386 388 test-win32text.t
387 389 test-xdg.t
@@ -1,49 +1,50 b''
1 1 # Test the config layer generated by environment variables
2 2
3 3 from __future__ import absolute_import, print_function
4 4
5 5 import os
6 6
7 7 from mercurial import (
8 8 encoding,
9 9 rcutil,
10 10 ui as uimod,
11 11 util,
12 12 )
13 13
14 testtmp = encoding.environ['TESTTMP']
14 testtmp = encoding.environ[b'TESTTMP']
15 15
16 16 # prepare hgrc files
17 17 def join(name):
18 18 return os.path.join(testtmp, name)
19 19
20 with open(join('sysrc'), 'w') as f:
21 f.write('[ui]\neditor=e0\n[pager]\npager=p0\n')
20 with open(join(b'sysrc'), 'wb') as f:
21 f.write(b'[ui]\neditor=e0\n[pager]\npager=p0\n')
22 22
23 with open(join('userrc'), 'w') as f:
24 f.write('[ui]\neditor=e1')
23 with open(join(b'userrc'), 'wb') as f:
24 f.write(b'[ui]\neditor=e1')
25 25
26 26 # replace rcpath functions so they point to the files above
27 27 def systemrcpath():
28 return [join('sysrc')]
28 return [join(b'sysrc')]
29 29
30 30 def userrcpath():
31 return [join('userrc')]
31 return [join(b'userrc')]
32 32
33 33 rcutil.systemrcpath = systemrcpath
34 34 rcutil.userrcpath = userrcpath
35 35 os.path.isdir = lambda x: False # hack: do not load default.d/*.rc
36 36
37 37 # utility to print configs
38 38 def printconfigs(env):
39 39 encoding.environ = env
40 40 rcutil._rccomponents = None # reset cache
41 41 ui = uimod.ui.load()
42 42 for section, name, value in ui.walkconfig():
43 43 source = ui.configsource(section, name)
44 print('%s.%s=%s # %s' % (section, name, value, util.pconvert(source)))
45 print('')
44 util.stdout.write(b'%s.%s=%s # %s\n'
45 % (section, name, value, util.pconvert(source)))
46 util.stdout.write(b'\n')
46 47
47 48 # environment variable overrides
48 49 printconfigs({})
49 printconfigs({'EDITOR': 'e2', 'PAGER': 'p2'})
50 printconfigs({b'EDITOR': b'e2', b'PAGER': b'p2'})
@@ -1,213 +1,213 b''
1 1 hide outer repo
2 2 $ hg init
3 3
4 4 Invalid syntax: no value
5 5
6 6 $ cat > .hg/hgrc << EOF
7 7 > novaluekey
8 8 > EOF
9 9 $ hg showconfig
10 10 hg: parse error at $TESTTMP/.hg/hgrc:1: novaluekey
11 11 [255]
12 12
13 13 Invalid syntax: no key
14 14
15 15 $ cat > .hg/hgrc << EOF
16 16 > =nokeyvalue
17 17 > EOF
18 18 $ hg showconfig
19 19 hg: parse error at $TESTTMP/.hg/hgrc:1: =nokeyvalue
20 20 [255]
21 21
22 22 Test hint about invalid syntax from leading white space
23 23
24 24 $ cat > .hg/hgrc << EOF
25 25 > key=value
26 26 > EOF
27 27 $ hg showconfig
28 28 hg: parse error at $TESTTMP/.hg/hgrc:1: key=value
29 29 unexpected leading whitespace
30 30 [255]
31 31
32 32 $ cat > .hg/hgrc << EOF
33 33 > [section]
34 34 > key=value
35 35 > EOF
36 36 $ hg showconfig
37 37 hg: parse error at $TESTTMP/.hg/hgrc:1: [section]
38 38 unexpected leading whitespace
39 39 [255]
40 40
41 41 Reset hgrc
42 42
43 43 $ echo > .hg/hgrc
44 44
45 45 Test case sensitive configuration
46 46
47 47 $ cat <<EOF >> $HGRCPATH
48 48 > [Section]
49 49 > KeY = Case Sensitive
50 50 > key = lower case
51 51 > EOF
52 52
53 53 $ hg showconfig Section
54 54 Section.KeY=Case Sensitive
55 55 Section.key=lower case
56 56
57 57 $ hg showconfig Section -Tjson
58 58 [
59 59 {
60 60 "name": "Section.KeY",
61 61 "source": "*.hgrc:*", (glob)
62 62 "value": "Case Sensitive"
63 63 },
64 64 {
65 65 "name": "Section.key",
66 66 "source": "*.hgrc:*", (glob)
67 67 "value": "lower case"
68 68 }
69 69 ]
70 70 $ hg showconfig Section.KeY -Tjson
71 71 [
72 72 {
73 73 "name": "Section.KeY",
74 74 "source": "*.hgrc:*", (glob)
75 75 "value": "Case Sensitive"
76 76 }
77 77 ]
78 78 $ hg showconfig -Tjson | tail -7
79 79 },
80 80 {
81 81 "name": "*", (glob)
82 82 "source": "*", (glob)
83 83 "value": "*" (glob)
84 84 }
85 85 ]
86 86
87 87 Test empty config source:
88 88
89 89 $ cat <<EOF > emptysource.py
90 90 > def reposetup(ui, repo):
91 > ui.setconfig('empty', 'source', 'value')
91 > ui.setconfig(b'empty', b'source', b'value')
92 92 > EOF
93 93 $ cp .hg/hgrc .hg/hgrc.orig
94 94 $ cat <<EOF >> .hg/hgrc
95 95 > [extensions]
96 96 > emptysource = `pwd`/emptysource.py
97 97 > EOF
98 98
99 99 $ hg config --debug empty.source
100 100 read config from: * (glob)
101 101 none: value
102 102 $ hg config empty.source -Tjson
103 103 [
104 104 {
105 105 "name": "empty.source",
106 106 "source": "",
107 107 "value": "value"
108 108 }
109 109 ]
110 110
111 111 $ cp .hg/hgrc.orig .hg/hgrc
112 112
113 113 Test "%unset"
114 114
115 115 $ cat >> $HGRCPATH <<EOF
116 116 > [unsettest]
117 117 > local-hgrcpath = should be unset (HGRCPATH)
118 118 > %unset local-hgrcpath
119 119 >
120 120 > global = should be unset (HGRCPATH)
121 121 >
122 122 > both = should be unset (HGRCPATH)
123 123 >
124 124 > set-after-unset = should be unset (HGRCPATH)
125 125 > EOF
126 126
127 127 $ cat >> .hg/hgrc <<EOF
128 128 > [unsettest]
129 129 > local-hgrc = should be unset (.hg/hgrc)
130 130 > %unset local-hgrc
131 131 >
132 132 > %unset global
133 133 >
134 134 > both = should be unset (.hg/hgrc)
135 135 > %unset both
136 136 >
137 137 > set-after-unset = should be unset (.hg/hgrc)
138 138 > %unset set-after-unset
139 139 > set-after-unset = should be set (.hg/hgrc)
140 140 > EOF
141 141
142 142 $ hg showconfig unsettest
143 143 unsettest.set-after-unset=should be set (.hg/hgrc)
144 144
145 145 Test exit code when no config matches
146 146
147 147 $ hg config Section.idontexist
148 148 [1]
149 149
150 150 sub-options in [paths] aren't expanded
151 151
152 152 $ cat > .hg/hgrc << EOF
153 153 > [paths]
154 154 > foo = ~/foo
155 155 > foo:suboption = ~/foo
156 156 > EOF
157 157
158 158 $ hg showconfig paths
159 159 paths.foo:suboption=~/foo
160 160 paths.foo=$TESTTMP/foo
161 161
162 162 edit failure
163 163
164 164 $ HGEDITOR=false hg config --edit
165 165 abort: edit failed: false exited with status 1
166 166 [255]
167 167
168 168 config affected by environment variables
169 169
170 170 $ EDITOR=e1 VISUAL=e2 hg config --debug | grep 'ui\.editor'
171 171 $VISUAL: ui.editor=e2
172 172
173 173 $ VISUAL=e2 hg config --debug --config ui.editor=e3 | grep 'ui\.editor'
174 174 --config: ui.editor=e3
175 175
176 176 $ PAGER=p1 hg config --debug | grep 'pager\.pager'
177 177 $PAGER: pager.pager=p1
178 178
179 179 $ PAGER=p1 hg config --debug --config pager.pager=p2 | grep 'pager\.pager'
180 180 --config: pager.pager=p2
181 181
182 182 verify that aliases are evaluated as well
183 183
184 184 $ hg init aliastest
185 185 $ cd aliastest
186 186 $ cat > .hg/hgrc << EOF
187 187 > [ui]
188 188 > user = repo user
189 189 > EOF
190 190 $ touch index
191 191 $ unset HGUSER
192 192 $ hg ci -Am test
193 193 adding index
194 194 $ hg log --template '{author}\n'
195 195 repo user
196 196 $ cd ..
197 197
198 198 alias has lower priority
199 199
200 200 $ hg init aliaspriority
201 201 $ cd aliaspriority
202 202 $ cat > .hg/hgrc << EOF
203 203 > [ui]
204 204 > user = alias user
205 205 > username = repo user
206 206 > EOF
207 207 $ touch index
208 208 $ unset HGUSER
209 209 $ hg ci -Am test
210 210 adding index
211 211 $ hg log --template '{author}\n'
212 212 repo user
213 213 $ cd ..
General Comments 0
You need to be logged in to leave comments. Login now