changeset 7192:06ae370ffaa3

ini: only keep default value as comment if the custom value actually is different
author Mads Kiilerich <mads@kiilerich.com>
date Sun, 11 Mar 2018 15:24:47 +0100
parents dba4e770d4b6
children 150173a027ee
files kallithea/lib/inifile.py
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/lib/inifile.py	Tue Mar 06 01:27:15 2018 +0100
+++ b/kallithea/lib/inifile.py	Sun Mar 11 15:24:47 2018 +0100
@@ -112,8 +112,10 @@
                 key, value = m.groups()
                 line = m.group(0)
                 if key in section_settings:
-                    # keep old entry as example - comments might refer to it
-                    line = '#%s\n%s = %s' % (line, key, section_settings.pop(key))
+                    new_line = '%s = %s' % (key, section_settings.pop(key))
+                    if new_line != line:
+                        # keep old entry as example - comments might refer to it
+                        line = '#%s\n%s' % (line, new_line)
                 return line.rstrip()
 
             # process lines that not are comments or empty and look like name=value