diff mercurial/commands.py @ 30618:201b44c8875c

ui: do not translate empty configsource() to 'none' (API) It should be processed when displaying data, so we can get "source": "" in JSON output.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 23 Oct 2016 17:47:00 +0900
parents 1112ff99d965
children 16b5df5792a8
line wrap: on
line diff
--- a/mercurial/commands.py	Sun Dec 18 16:20:04 2016 +0900
+++ b/mercurial/commands.py	Sun Oct 23 17:47:00 2016 +0900
@@ -1804,29 +1804,28 @@
             raise error.Abort(_('only one config item permitted'))
     matched = False
     for section, name, value in ui.walkconfig(untrusted=untrusted):
+        source = ui.configsource(section, name, untrusted)
         value = str(value)
         if fm.isplain():
+            source = source or 'none'
             value = value.replace('\n', '\\n')
         entryname = section + '.' + name
         if values:
             for v in values:
                 if v == section:
                     fm.startitem()
-                    fm.condwrite(ui.debugflag, 'source', '%s: ',
-                                 ui.configsource(section, name, untrusted))
+                    fm.condwrite(ui.debugflag, 'source', '%s: ', source)
                     fm.write('name value', '%s=%s\n', entryname, value)
                     matched = True
                 elif v == entryname:
                     fm.startitem()
-                    fm.condwrite(ui.debugflag, 'source', '%s: ',
-                                 ui.configsource(section, name, untrusted))
+                    fm.condwrite(ui.debugflag, 'source', '%s: ', source)
                     fm.write('value', '%s\n', value)
                     fm.data(name=entryname)
                     matched = True
         else:
             fm.startitem()
-            fm.condwrite(ui.debugflag, 'source', '%s: ',
-                         ui.configsource(section, name, untrusted))
+            fm.condwrite(ui.debugflag, 'source', '%s: ', source)
             fm.write('name value', '%s=%s\n', entryname, value)
             matched = True
     fm.end()