mercurial/commands.py
changeset 20570 c21e1e3ab915
parent 20558 c4f45ce85351
child 20572 c724cb0141ee
equal deleted inserted replaced
20569:0d4be103c734 20570:c21e1e3ab915
  1459                 ui.status(_("nothing changed\n"))
  1459                 ui.status(_("nothing changed\n"))
  1460             return 1
  1460             return 1
  1461 
  1461 
  1462     cmdutil.commitstatus(repo, node, branch, bheads, opts)
  1462     cmdutil.commitstatus(repo, node, branch, bheads, opts)
  1463 
  1463 
       
  1464 @command('config|showconfig|debugconfig',
       
  1465     [('u', 'untrusted', None, _('show untrusted configuration options'))],
       
  1466     _('[-u] [NAME]...'))
       
  1467 def config(ui, repo, *values, **opts):
       
  1468     """show combined config settings from all hgrc files
       
  1469 
       
  1470     With no arguments, print names and values of all config items.
       
  1471 
       
  1472     With one argument of the form section.name, print just the value
       
  1473     of that config item.
       
  1474 
       
  1475     With multiple arguments, print names and values of all config
       
  1476     items with matching section names.
       
  1477 
       
  1478     With --debug, the source (filename and line number) is printed
       
  1479     for each config item.
       
  1480 
       
  1481     Returns 0 on success.
       
  1482     """
       
  1483 
       
  1484     for f in scmutil.rcpath():
       
  1485         ui.debug('read config from: %s\n' % f)
       
  1486     untrusted = bool(opts.get('untrusted'))
       
  1487     if values:
       
  1488         sections = [v for v in values if '.' not in v]
       
  1489         items = [v for v in values if '.' in v]
       
  1490         if len(items) > 1 or items and sections:
       
  1491             raise util.Abort(_('only one config item permitted'))
       
  1492     for section, name, value in ui.walkconfig(untrusted=untrusted):
       
  1493         value = str(value).replace('\n', '\\n')
       
  1494         sectname = section + '.' + name
       
  1495         if values:
       
  1496             for v in values:
       
  1497                 if v == section:
       
  1498                     ui.debug('%s: ' %
       
  1499                              ui.configsource(section, name, untrusted))
       
  1500                     ui.write('%s=%s\n' % (sectname, value))
       
  1501                 elif v == sectname:
       
  1502                     ui.debug('%s: ' %
       
  1503                              ui.configsource(section, name, untrusted))
       
  1504                     ui.write(value, '\n')
       
  1505         else:
       
  1506             ui.debug('%s: ' %
       
  1507                      ui.configsource(section, name, untrusted))
       
  1508             ui.write('%s=%s\n' % (sectname, value))
       
  1509 
  1464 @command('copy|cp',
  1510 @command('copy|cp',
  1465     [('A', 'after', None, _('record a copy that has already occurred')),
  1511     [('A', 'after', None, _('record a copy that has already occurred')),
  1466     ('f', 'force', None, _('forcibly copy over an existing managed file')),
  1512     ('f', 'force', None, _('forcibly copy over an existing managed file')),
  1467     ] + walkopts + dryrunopts,
  1513     ] + walkopts + dryrunopts,
  1468     _('[OPTION]... [SOURCE]... DEST'))
  1514     _('[OPTION]... [SOURCE]... DEST'))
  5159               (fqaddr, port, prefix, bindaddr, self.httpd.port))
  5205               (fqaddr, port, prefix, bindaddr, self.httpd.port))
  5160 
  5206 
  5161     def run(self):
  5207     def run(self):
  5162         self.httpd.serve_forever()
  5208         self.httpd.serve_forever()
  5163 
  5209 
  5164 
       
  5165 @command('showconfig|debugconfig',
       
  5166     [('u', 'untrusted', None, _('show untrusted configuration options'))],
       
  5167     _('[-u] [NAME]...'))
       
  5168 def showconfig(ui, repo, *values, **opts):
       
  5169     """show combined config settings from all hgrc files
       
  5170 
       
  5171     With no arguments, print names and values of all config items.
       
  5172 
       
  5173     With one argument of the form section.name, print just the value
       
  5174     of that config item.
       
  5175 
       
  5176     With multiple arguments, print names and values of all config
       
  5177     items with matching section names.
       
  5178 
       
  5179     With --debug, the source (filename and line number) is printed
       
  5180     for each config item.
       
  5181 
       
  5182     Returns 0 on success.
       
  5183     """
       
  5184 
       
  5185     for f in scmutil.rcpath():
       
  5186         ui.debug('read config from: %s\n' % f)
       
  5187     untrusted = bool(opts.get('untrusted'))
       
  5188     if values:
       
  5189         sections = [v for v in values if '.' not in v]
       
  5190         items = [v for v in values if '.' in v]
       
  5191         if len(items) > 1 or items and sections:
       
  5192             raise util.Abort(_('only one config item permitted'))
       
  5193     for section, name, value in ui.walkconfig(untrusted=untrusted):
       
  5194         value = str(value).replace('\n', '\\n')
       
  5195         sectname = section + '.' + name
       
  5196         if values:
       
  5197             for v in values:
       
  5198                 if v == section:
       
  5199                     ui.debug('%s: ' %
       
  5200                              ui.configsource(section, name, untrusted))
       
  5201                     ui.write('%s=%s\n' % (sectname, value))
       
  5202                 elif v == sectname:
       
  5203                     ui.debug('%s: ' %
       
  5204                              ui.configsource(section, name, untrusted))
       
  5205                     ui.write(value, '\n')
       
  5206         else:
       
  5207             ui.debug('%s: ' %
       
  5208                      ui.configsource(section, name, untrusted))
       
  5209             ui.write('%s=%s\n' % (sectname, value))
       
  5210 
  5210 
  5211 @command('^status|st',
  5211 @command('^status|st',
  5212     [('A', 'all', None, _('show status of all files')),
  5212     [('A', 'all', None, _('show status of all files')),
  5213     ('m', 'modified', None, _('show only modified files')),
  5213     ('m', 'modified', None, _('show only modified files')),
  5214     ('a', 'added', None, _('show only added files')),
  5214     ('a', 'added', None, _('show only added files')),