Merge lp:~vila/bzr/930182-display-reg-options into lp:bzr
Status: | Merged |
---|---|
Approved by: | Jelmer Vernooij |
Approved revision: | no longer in the source branch. |
Merged at revision: | 6471 |
Proposed branch: | lp:~vila/bzr/930182-display-reg-options |
Merge into: | lp:bzr |
Diff against target: |
272 lines (+106/-49) 4 files modified
bzrlib/config.py (+43/-45) bzrlib/tests/blackbox/test_config.py (+20/-2) bzrlib/tests/test_config.py (+40/-2) doc/en/release-notes/bzr-2.6.txt (+3/-0) |
To merge this branch: | bzr merge lp:~vila/bzr/930182-display-reg-options |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Jelmer Vernooij (community) | Needs Fixing | ||
Review via email: mp+92807@code.launchpad.net |
Commit message
Fix RegistryOption display in bzr config output
Description of the change
bzr config was still relying too much on configobj for proper quoting.
After a bit if ping-pong to fix quoting fallouts, this proposal fixes bzr
config display for all values by *not* calling (indirectly) the
``from_unicode`` method for registered options.
Thanks to Jelmer for pushing me forward on this one as I first mistakenly
thought that stack.get() and stack.set() should be symmetric.
For the record, they are not and 'from_unicode' have been introduced
precisely to make dev's life easier. ``bool_from_store`` for example accepts
'off' to means False which already breaks this symmetry ('False' is an
accepted string for booleans which makes this fact a little less obvious).
stack.set() still relies on stringification for bool, int and lists and that
seem to be the most pragmatic thing to do.
A little care should still be taken when setting values for RegistryOptions
and devs have to remember that the values stored are keys for the registry
not object themselves (we can't (or rather don't want to)) store objects in
text files but this doesn't have to force them to avoid writing from_unicode
helpers.
Wow, I just realized there was a nasty potential bug in the option expansion: conversion should never be attempted during expansion where all values should remain strings. The conversion should be done only for the outer get() call.
The fix is a one-liner.