changeset 13576:edd06611a7c6

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.
author Martin Geisler <mg@aragost.com>
date Thu, 10 Mar 2011 16:49:37 +0100
parents 1bb2a56a9d73
children 18937290986c
files mercurial/commands.py mercurial/ui.py
diffstat 2 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- 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?