1630 |
1630 |
1631 With one argument of the form section.name, print just the value |
1631 With one argument of the form section.name, print just the value |
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 |
1639 repository-level config file. |
1639 repository-level config file. |
1640 |
1640 |
1696 |
1696 |
1697 selsections = selentries = [] |
1697 selsections = selentries = [] |
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 |
1706 matched = False |
1705 matched = False |
1707 for section, name, value in ui.walkconfig(untrusted=untrusted): |
1706 for section, name, value in ui.walkconfig(untrusted=untrusted): |
1709 value = pycompat.bytestr(value) |
1708 value = pycompat.bytestr(value) |
1710 if fm.isplain(): |
1709 if fm.isplain(): |
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 |
1734 return 1 |
1726 return 1 |
1735 |
1727 |