author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
Wed, 11 Oct 2006 16:41:52 +0200 | |
changeset 3331 | f472cf9a71af |
parent 3073 | 24c1db20990c |
child 3346 | 1700a103458e |
permissions | -rwxr-xr-x |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
1 |
#!/usr/bin/env python |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
2 |
|
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
3 |
from mercurial import ui, util |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
4 |
|
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
5 |
testui = ui.ui() |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
6 |
testui.updateopts(config=[ |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
7 |
'values.string=string value', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
8 |
'values.bool1=true', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
9 |
'values.bool2=false', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
10 |
'lists.list1=foo', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
11 |
'lists.list2=foo bar baz', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
12 |
'lists.list3=alice, bob', |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
13 |
'lists.list4=foo bar baz alice, bob', |
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
14 |
'interpolation.value1=hallo', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
15 |
'interpolation.value2=%(value1)s world', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
16 |
'interpolation.value3=%(novalue)s', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
17 |
'interpolation.value4=%(bad)1', |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
18 |
'interpolation.value5=%bad2', |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
19 |
]) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
20 |
|
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
21 |
print repr(testui.configitems('values')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
22 |
print repr(testui.configitems('lists')) |
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
23 |
try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
24 |
print repr(testui.configitems('interpolation')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
25 |
except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
26 |
print inst |
2502
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
27 |
print "---" |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
28 |
print repr(testui.config('values', 'string')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
29 |
print repr(testui.config('values', 'bool1')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
30 |
print repr(testui.config('values', 'bool2')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
31 |
print repr(testui.config('values', 'unknown')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
32 |
print "---" |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
33 |
try: |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
34 |
print repr(testui.configbool('values', 'string')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
35 |
except ValueError, why: |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
36 |
print why |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
37 |
print repr(testui.configbool('values', 'bool1')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
38 |
print repr(testui.configbool('values', 'bool2')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
39 |
print repr(testui.configbool('values', 'bool2', True)) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
40 |
print repr(testui.configbool('values', 'unknown')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
41 |
print repr(testui.configbool('values', 'unknown', True)) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
42 |
print "---" |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
43 |
print repr(testui.configlist('lists', 'list1')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
44 |
print repr(testui.configlist('lists', 'list2')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
45 |
print repr(testui.configlist('lists', 'list3')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
46 |
print repr(testui.configlist('lists', 'list4')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
47 |
print repr(testui.configlist('lists', 'list4', ['foo'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
48 |
print repr(testui.configlist('lists', 'unknown')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
49 |
print repr(testui.configlist('lists', 'unknown', '')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
50 |
print repr(testui.configlist('lists', 'unknown', 'foo')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
51 |
print repr(testui.configlist('lists', 'unknown', ['foo'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
52 |
print repr(testui.configlist('lists', 'unknown', 'foo bar')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
53 |
print repr(testui.configlist('lists', 'unknown', 'foo, bar')) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
54 |
print repr(testui.configlist('lists', 'unknown', ['foo bar'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
55 |
print repr(testui.configlist('lists', 'unknown', ['foo', 'bar'])) |
18cf95ad3666
Allow using default values with ui.configlist, too, and add a test for this.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
diff
changeset
|
56 |
print "---" |
3073
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
57 |
print repr(testui.config('interpolation', 'value1')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
58 |
print repr(testui.config('interpolation', 'value2')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
59 |
try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
60 |
print repr(testui.config('interpolation', 'value3')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
61 |
except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
62 |
print inst |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
63 |
try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
64 |
print repr(testui.config('interpolation', 'value4')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
65 |
except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
66 |
print inst |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
67 |
try: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
68 |
print repr(testui.config('interpolation', 'value5')) |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
69 |
except util.Abort, inst: |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
70 |
print inst |
24c1db20990c
Include section name and parameter name (if available) in config errors.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
2502
diff
changeset
|
71 |
print "---" |