ui: yield unchanged values in walkconfig
Ever since walkconfig was introduced back in
25e7ea0f2cff, the values
yielded has been mutated by replacing "\n" with "\\n". This makes
walkconfig less useful than it could and there is no other way to
iterate over all config sections.
The third-party reposettings extension used ui.walkconfig but did not
take the replacement into account -- this change will actually fix a
bug in the extension when a value contains a newline.
--- a/mercurial/commands.py Thu Mar 10 13:43:47 2011 +0100
+++ b/mercurial/commands.py Thu Mar 10 16:49:37 2011 +0100
@@ -1175,6 +1175,7 @@
if len(items) > 1 or items and sections:
raise util.Abort(_('only one config item permitted'))
for section, name, value in ui.walkconfig(untrusted=untrusted):
+ value = str(value).replace('\n', '\\n')
sectname = section + '.' + name
if values:
for v in values:
--- a/mercurial/ui.py Thu Mar 10 13:43:47 2011 +0100
+++ b/mercurial/ui.py Thu Mar 10 16:49:37 2011 +0100
@@ -273,7 +273,7 @@
cfg = self._data(untrusted)
for section in cfg.sections():
for name, value in self.configitems(section, untrusted):
- yield section, name, str(value).replace('\n', '\\n')
+ yield section, name, value
def plain(self):
'''is plain mode active?