##// END OF EJS Templates
showconfig: allow multiple section.name selectors (issue5797)...
Yuya Nishihara -
r36435:199443c5 default
parent child Browse files
Show More
@@ -1632,7 +1632,7 b' def config(ui, repo, *values, **opts):'
1632 of that config item.
1632 of that config item.
1633
1633
1634 With multiple arguments, print names and values of all config
1634 With multiple arguments, print names and values of all config
1635 items with matching section names.
1635 items with matching section names or section.names.
1636
1636
1637 With --edit, start an editor on the user-level config file. With
1637 With --edit, start an editor on the user-level config file. With
1638 --global, edit the system-wide config file. With --local, edit the
1638 --global, edit the system-wide config file. With --local, edit the
@@ -1698,8 +1698,7 b' def config(ui, repo, *values, **opts):'
1698 if values:
1698 if values:
1699 selsections = [v for v in values if '.' not in v]
1699 selsections = [v for v in values if '.' not in v]
1700 selentries = [v for v in values if '.' in v]
1700 selentries = [v for v in values if '.' in v]
1701 if len(selentries) > 1 or selentries and selsections:
1701 uniquesel = (len(selentries) == 1 and not selsections)
1702 raise error.Abort(_('only one config item permitted'))
1703 selsections = set(selsections)
1702 selsections = set(selsections)
1704 selentries = set(selentries)
1703 selentries = set(selentries)
1705
1704
@@ -1711,23 +1710,16 b' def config(ui, repo, *values, **opts):'
1711 source = source or 'none'
1710 source = source or 'none'
1712 value = value.replace('\n', '\\n')
1711 value = value.replace('\n', '\\n')
1713 entryname = section + '.' + name
1712 entryname = section + '.' + name
1714 if values:
1713 if values and not (section in selsections or entryname in selentries):
1715 if section in selsections:
1714 continue
1716 fm.startitem()
1715 fm.startitem()
1717 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1716 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1718 fm.write('name value', '%s=%s\n', entryname, value)
1717 if uniquesel:
1719 matched = True
1718 fm.data(name=entryname)
1720 elif entryname in selentries:
1719 fm.write('value', '%s\n', value)
1721 fm.startitem()
1722 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1723 fm.write('value', '%s\n', value)
1724 fm.data(name=entryname)
1725 matched = True
1726 else:
1720 else:
1727 fm.startitem()
1728 fm.condwrite(ui.debugflag, 'source', '%s: ', source)
1729 fm.write('name value', '%s=%s\n', entryname, value)
1721 fm.write('name value', '%s=%s\n', entryname, value)
1730 matched = True
1722 matched = True
1731 fm.end()
1723 fm.end()
1732 if matched:
1724 if matched:
1733 return 0
1725 return 0
@@ -129,14 +129,13 b' showconfig with multiple arguments'
129 $ hg showconfig alias alias
129 $ hg showconfig alias alias
130 alias.log=log -g
130 alias.log=log -g
131 $ hg showconfig alias.log alias.log
131 $ hg showconfig alias.log alias.log
132 abort: only one config item permitted
132 alias.log=log -g
133 [255]
134 $ hg showconfig alias defaults.identify
133 $ hg showconfig alias defaults.identify
135 abort: only one config item permitted
134 alias.log=log -g
136 [255]
135 defaults.identify=-n
137 $ hg showconfig alias.log defaults.identify
136 $ hg showconfig alias.log defaults.identify
138 abort: only one config item permitted
137 alias.log=log -g
139 [255]
138 defaults.identify=-n
140
139
141 HGPLAIN
140 HGPLAIN
142
141
General Comments 0
You need to be logged in to leave comments. Login now