Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 42699:51a2e3102db2
config: add defaultvalue template keyword
This patch tries to fix one of the issues mentioned in issue6014.
This adds a new `defaultvalue` template keyword to be used with
`hg showconfig` to get the default value of the config item.
Differential Revision: https://phab.mercurial-scm.org/D6704
author | Navaneeth Suresh <navaneeths1998@gmail.com> |
---|---|
date | Thu, 01 Aug 2019 22:03:52 +0530 |
parents | 0795bbe8ed19 |
children | 049b2ac3252e |
comparison
equal
deleted
inserted
replaced
42698:e77be7e2109f | 42699:51a2e3102db2 |
---|---|
1870 | 1870 |
1871 matched = False | 1871 matched = False |
1872 for section, name, value in ui.walkconfig(untrusted=untrusted): | 1872 for section, name, value in ui.walkconfig(untrusted=untrusted): |
1873 source = ui.configsource(section, name, untrusted) | 1873 source = ui.configsource(section, name, untrusted) |
1874 value = pycompat.bytestr(value) | 1874 value = pycompat.bytestr(value) |
1875 defaultvalue = pycompat.bytestr(ui.configdefault(section, name)) | |
1875 if fm.isplain(): | 1876 if fm.isplain(): |
1876 source = source or 'none' | 1877 source = source or 'none' |
1877 value = value.replace('\n', '\\n') | 1878 value = value.replace('\n', '\\n') |
1878 entryname = section + '.' + name | 1879 entryname = section + '.' + name |
1879 if values and not (section in selsections or entryname in selentries): | 1880 if values and not (section in selsections or entryname in selentries): |
1880 continue | 1881 continue |
1881 fm.startitem() | 1882 fm.startitem() |
1882 fm.condwrite(ui.debugflag, 'source', '%s: ', source) | 1883 fm.condwrite(ui.debugflag, 'source', '%s: ', source) |
1883 if uniquesel: | 1884 if uniquesel: |
1884 fm.data(name=entryname) | 1885 fm.data(name=entryname, defaultvalue=defaultvalue) |
1885 fm.write('value', '%s\n', value) | 1886 fm.write('value', '%s\n', value) |
1886 else: | 1887 else: |
1887 fm.write('name value', '%s=%s\n', entryname, value) | 1888 fm.write('name value', '%s=%s\n', entryname, value) |
1888 matched = True | 1889 matched = True |
1889 fm.end() | 1890 fm.end() |