mercurial/commands.py
changeset 20782 13fcb9ca9ccc
parent 20773 efbf15979538
child 20783 43054dc84abd
equal deleted inserted replaced
20781:8ecfa225bd16 20782:13fcb9ca9ccc
  1460 
  1460 
  1461     cmdutil.commitstatus(repo, node, branch, bheads, opts)
  1461     cmdutil.commitstatus(repo, node, branch, bheads, opts)
  1462 
  1462 
  1463 @command('config|showconfig|debugconfig',
  1463 @command('config|showconfig|debugconfig',
  1464     [('u', 'untrusted', None, _('show untrusted configuration options')),
  1464     [('u', 'untrusted', None, _('show untrusted configuration options')),
  1465      ('e', 'edit', None, _('start editor'))],
  1465      ('e', 'edit', None, _('edit user config')),
  1466     _('[-u] [NAME]...'))
  1466      ('l', 'local', None, _('edit repository config')),
       
  1467      ('g', 'global', None, _('edit global config'))],
       
  1468       _('[-u] [NAME]...'))
  1467 def config(ui, repo, *values, **opts):
  1469 def config(ui, repo, *values, **opts):
  1468     """show combined config settings from all hgrc files
  1470     """show combined config settings from all hgrc files
  1469 
  1471 
  1470     With no arguments, print names and values of all config items.
  1472     With no arguments, print names and values of all config items.
  1471 
  1473 
  1479     for each config item.
  1481     for each config item.
  1480 
  1482 
  1481     Returns 0 on success.
  1483     Returns 0 on success.
  1482     """
  1484     """
  1483 
  1485 
  1484     if opts.get('edit'):
  1486     if opts.get('edit') or opts.get('local') or opts.get('global'):
  1485         paths = scmutil.userrcpath()
  1487         if opts.get('local') and opts.get('global'):
       
  1488             raise util.Abort(_("can't use --local and --global together"))
       
  1489 
       
  1490         if opts.get('local'):
       
  1491             if not repo:
       
  1492                 raise util.Abort(_("can't use --local outside a repository"))
       
  1493             paths = [repo.join('hgrc')]
       
  1494         elif opts.get('global'):
       
  1495             paths = scmutil.systemrcpath()
       
  1496         else:
       
  1497             paths = scmutil.userrcpath()
       
  1498 
  1486         for f in paths:
  1499         for f in paths:
  1487             if os.path.exists(f):
  1500             if os.path.exists(f):
  1488                 break
  1501                 break
  1489         else:
  1502         else:
  1490             f = paths[0]
  1503             f = paths[0]