Mercurial > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
30617:32a07b8a9f77 | 30618:201b44c8875c |
---|---|
1802 items = [v for v in values if '.' in v] | 1802 items = [v for v in values if '.' in v] |
1803 if len(items) > 1 or items and sections: | 1803 if len(items) > 1 or items and sections: |
1804 raise error.Abort(_('only one config item permitted')) | 1804 raise error.Abort(_('only one config item permitted')) |
1805 matched = False | 1805 matched = False |
1806 for section, name, value in ui.walkconfig(untrusted=untrusted): | 1806 for section, name, value in ui.walkconfig(untrusted=untrusted): |
1807 source = ui.configsource(section, name, untrusted) | |
1807 value = str(value) | 1808 value = str(value) |
1808 if fm.isplain(): | 1809 if fm.isplain(): |
1810 source = source or 'none' | |
1809 value = value.replace('\n', '\\n') | 1811 value = value.replace('\n', '\\n') |
1810 entryname = section + '.' + name | 1812 entryname = section + '.' + name |
1811 if values: | 1813 if values: |
1812 for v in values: | 1814 for v in values: |
1813 if v == section: | 1815 if v == section: |
1814 fm.startitem() | 1816 fm.startitem() |
1815 fm.condwrite(ui.debugflag, 'source', '%s: ', | 1817 fm.condwrite(ui.debugflag, 'source', '%s: ', source) |
1816 ui.configsource(section, name, untrusted)) | |
1817 fm.write('name value', '%s=%s\n', entryname, value) | 1818 fm.write('name value', '%s=%s\n', entryname, value) |
1818 matched = True | 1819 matched = True |
1819 elif v == entryname: | 1820 elif v == entryname: |
1820 fm.startitem() | 1821 fm.startitem() |
1821 fm.condwrite(ui.debugflag, 'source', '%s: ', | 1822 fm.condwrite(ui.debugflag, 'source', '%s: ', source) |
1822 ui.configsource(section, name, untrusted)) | |
1823 fm.write('value', '%s\n', value) | 1823 fm.write('value', '%s\n', value) |
1824 fm.data(name=entryname) | 1824 fm.data(name=entryname) |
1825 matched = True | 1825 matched = True |
1826 else: | 1826 else: |
1827 fm.startitem() | 1827 fm.startitem() |
1828 fm.condwrite(ui.debugflag, 'source', '%s: ', | 1828 fm.condwrite(ui.debugflag, 'source', '%s: ', source) |
1829 ui.configsource(section, name, untrusted)) | |
1830 fm.write('name value', '%s=%s\n', entryname, value) | 1829 fm.write('name value', '%s=%s\n', entryname, value) |
1831 matched = True | 1830 matched = True |
1832 fm.end() | 1831 fm.end() |
1833 if matched: | 1832 if matched: |
1834 return 0 | 1833 return 0 |