Mercurial > hg
comparison tests/test-check-config.t @ 33195:5d8942dbe49e
check-config: syntax to allow inconsistent config values
The ignore regular expression has been updated to detect
"inconsistent config." If present, we track which configs have
that set and we suppress the conflicting defaults error for those
options.
I also added named groups to the regexp to aid readability.
A comment was added to profiling.py to make a desired inconsistent
value error go away.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sat, 01 Jul 2017 20:34:27 -0700 |
parents | 6c113a7dec52 |
children | ddd65b4f3ae6 |
comparison
equal
deleted
inserted
replaced
33194:c077eac329e2 | 33195:5d8942dbe49e |
---|---|
12 > # Missing different type | 12 > # Missing different type |
13 > foo = ui.configint('ui', 'missingint') | 13 > foo = ui.configint('ui', 'missingint') |
14 > # Missing with default value | 14 > # Missing with default value |
15 > foo = ui.configbool('ui', 'missingbool1', default=True) | 15 > foo = ui.configbool('ui', 'missingbool1', default=True) |
16 > foo = ui.configbool('ui', 'missingbool2', False) | 16 > foo = ui.configbool('ui', 'missingbool2', False) |
17 > # Inconsistent values for defaults. | |
18 > foo = ui.configint('ui', 'intdefault', default=1) | |
19 > foo = ui.configint('ui', 'intdefault', default=42) | |
20 > # Can suppress inconsistent value error | |
21 > foo = ui.configint('ui', 'intdefault2', default=1) | |
22 > # inconsistent config: ui.intdefault2 | |
23 > foo = ui.configint('ui', 'intdefault2', default=42) | |
17 > EOF | 24 > EOF |
18 | 25 |
19 $ cat > files << EOF | 26 $ cat > files << EOF |
20 > mercurial/help/config.txt | 27 > mercurial/help/config.txt |
21 > $TESTTMP/testfile.py | 28 > $TESTTMP/testfile.py |
22 > EOF | 29 > EOF |
23 | 30 |
24 $ cd "$TESTDIR"/.. | 31 $ cd "$TESTDIR"/.. |
25 | 32 |
26 $ $PYTHON contrib/check-config.py < $TESTTMP/files | 33 $ $PYTHON contrib/check-config.py < $TESTTMP/files |
34 foo = ui.configint('ui', 'intdefault', default=42) | |
35 | |
36 conflict on ui.intdefault: ('int', '42') != ('int', '1') | |
27 undocumented: ui.doesnotexist (str) | 37 undocumented: ui.doesnotexist (str) |
38 undocumented: ui.intdefault (int) [42] | |
39 undocumented: ui.intdefault2 (int) [42] | |
28 undocumented: ui.missingbool1 (bool) [True] | 40 undocumented: ui.missingbool1 (bool) [True] |
29 undocumented: ui.missingbool2 (bool) | 41 undocumented: ui.missingbool2 (bool) |
30 undocumented: ui.missingint (int) | 42 undocumented: ui.missingint (int) |
31 | 43 |
32 New errors are not allowed. Warnings are strongly discouraged. | 44 New errors are not allowed. Warnings are strongly discouraged. |
33 | 45 |
34 $ syshg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' | | 46 $ syshg files "set:(**.py or **.txt) - tests/**" | sed 's|\\|/|g' | |
35 > $PYTHON contrib/check-config.py | 47 > $PYTHON contrib/check-config.py |
36 limit = ui.configwith(fraction, 'profiling', 'showmin', 0.05) | |
37 | |
38 conflict on profiling.showmin: ('with', '0.05') != ('with', '0.005') |