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