comparison mercurial/commands.py @ 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 0b79cf616e65
children 2e80d495592a
comparison
equal deleted inserted replaced
13572:1bb2a56a9d73 13576:edd06611a7c6
1173 sections = [v for v in values if '.' not in v] 1173 sections = [v for v in values if '.' not in v]
1174 items = [v for v in values if '.' in v] 1174 items = [v for v in values if '.' in v]
1175 if len(items) > 1 or items and sections: 1175 if len(items) > 1 or items and sections:
1176 raise util.Abort(_('only one config item permitted')) 1176 raise util.Abort(_('only one config item permitted'))
1177 for section, name, value in ui.walkconfig(untrusted=untrusted): 1177 for section, name, value in ui.walkconfig(untrusted=untrusted):
1178 value = str(value).replace('\n', '\\n')
1178 sectname = section + '.' + name 1179 sectname = section + '.' + name
1179 if values: 1180 if values:
1180 for v in values: 1181 for v in values:
1181 if v == section: 1182 if v == section:
1182 ui.debug('%s: ' % 1183 ui.debug('%s: ' %