##// END OF EJS Templates
order commands alphabetically
Sune Foldager -
r14302:b0f97b25 default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (550 lines changed) Show them Hide them
@@ -1330,150 +1330,6 b' def debugbuilddag(ui, repo, text=None,'
1330 if tags:
1330 if tags:
1331 repo.opener.write("localtags", "".join(tags))
1331 repo.opener.write("localtags", "".join(tags))
1332
1332
1333 @command('debugcommands', [], _('[COMMAND]'))
1334 def debugcommands(ui, cmd='', *args):
1335 """list all available commands and options"""
1336 for cmd, vals in sorted(table.iteritems()):
1337 cmd = cmd.split('|')[0].strip('^')
1338 opts = ', '.join([i[1] for i in vals[1]])
1339 ui.write('%s: %s\n' % (cmd, opts))
1340
1341 @command('debugcomplete',
1342 [('o', 'options', None, _('show the command options'))],
1343 _('[-o] CMD'))
1344 def debugcomplete(ui, cmd='', **opts):
1345 """returns the completion list associated with the given command"""
1346
1347 if opts.get('options'):
1348 options = []
1349 otables = [globalopts]
1350 if cmd:
1351 aliases, entry = cmdutil.findcmd(cmd, table, False)
1352 otables.append(entry[1])
1353 for t in otables:
1354 for o in t:
1355 if "(DEPRECATED)" in o[3]:
1356 continue
1357 if o[0]:
1358 options.append('-%s' % o[0])
1359 options.append('--%s' % o[1])
1360 ui.write("%s\n" % "\n".join(options))
1361 return
1362
1363 cmdlist = cmdutil.findpossible(cmd, table)
1364 if ui.verbose:
1365 cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
1366 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
1367
1368 @command('debugfsinfo', [], _('[PATH]'))
1369 def debugfsinfo(ui, path = "."):
1370 """show information detected about current filesystem"""
1371 util.writefile('.debugfsinfo', '')
1372 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
1373 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
1374 ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
1375 and 'yes' or 'no'))
1376 os.unlink('.debugfsinfo')
1377
1378 @command('debugrebuildstate',
1379 [('r', 'rev', '', _('revision to rebuild to'), _('REV'))],
1380 _('[-r REV] [REV]'))
1381 def debugrebuildstate(ui, repo, rev="tip"):
1382 """rebuild the dirstate as it would look like for the given revision"""
1383 ctx = cmdutil.revsingle(repo, rev)
1384 wlock = repo.wlock()
1385 try:
1386 repo.dirstate.rebuild(ctx.node(), ctx.manifest())
1387 finally:
1388 wlock.release()
1389
1390 @command('debugcheckstate', [], '')
1391 def debugcheckstate(ui, repo):
1392 """validate the correctness of the current dirstate"""
1393 parent1, parent2 = repo.dirstate.parents()
1394 m1 = repo[parent1].manifest()
1395 m2 = repo[parent2].manifest()
1396 errors = 0
1397 for f in repo.dirstate:
1398 state = repo.dirstate[f]
1399 if state in "nr" and f not in m1:
1400 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
1401 errors += 1
1402 if state in "a" and f in m1:
1403 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
1404 errors += 1
1405 if state in "m" and f not in m1 and f not in m2:
1406 ui.warn(_("%s in state %s, but not in either manifest\n") %
1407 (f, state))
1408 errors += 1
1409 for f in m1:
1410 state = repo.dirstate[f]
1411 if state not in "nrm":
1412 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
1413 errors += 1
1414 if errors:
1415 error = _(".hg/dirstate inconsistent with current parent's manifest")
1416 raise util.Abort(error)
1417
1418 @command('showconfig|debugconfig',
1419 [('u', 'untrusted', None, _('show untrusted configuration options'))],
1420 _('[-u] [NAME]...'))
1421 def showconfig(ui, repo, *values, **opts):
1422 """show combined config settings from all hgrc files
1423
1424 With no arguments, print names and values of all config items.
1425
1426 With one argument of the form section.name, print just the value
1427 of that config item.
1428
1429 With multiple arguments, print names and values of all config
1430 items with matching section names.
1431
1432 With --debug, the source (filename and line number) is printed
1433 for each config item.
1434
1435 Returns 0 on success.
1436 """
1437
1438 for f in scmutil.rcpath():
1439 ui.debug(_('read config from: %s\n') % f)
1440 untrusted = bool(opts.get('untrusted'))
1441 if values:
1442 sections = [v for v in values if '.' not in v]
1443 items = [v for v in values if '.' in v]
1444 if len(items) > 1 or items and sections:
1445 raise util.Abort(_('only one config item permitted'))
1446 for section, name, value in ui.walkconfig(untrusted=untrusted):
1447 value = str(value).replace('\n', '\\n')
1448 sectname = section + '.' + name
1449 if values:
1450 for v in values:
1451 if v == section:
1452 ui.debug('%s: ' %
1453 ui.configsource(section, name, untrusted))
1454 ui.write('%s=%s\n' % (sectname, value))
1455 elif v == sectname:
1456 ui.debug('%s: ' %
1457 ui.configsource(section, name, untrusted))
1458 ui.write(value, '\n')
1459 else:
1460 ui.debug('%s: ' %
1461 ui.configsource(section, name, untrusted))
1462 ui.write('%s=%s\n' % (sectname, value))
1463
1464 @command('debugknown', [], _('REPO ID...'))
1465 def debugknown(ui, repopath, *ids, **opts):
1466 """test whether node ids are known to a repo
1467
1468 Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
1469 indicating unknown/known.
1470 """
1471 repo = hg.repository(ui, repopath)
1472 if not repo.capable('known'):
1473 raise util.Abort("known() not supported by target repository")
1474 flags = repo.known([bin(s) for s in ids])
1475 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1476
1477 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
1333 @command('debugbundle', [('a', 'all', None, _('show all details'))], _('FILE'))
1478 def debugbundle(ui, bundlepath, all=None, **opts):
1334 def debugbundle(ui, bundlepath, all=None, **opts):
1479 """lists the contents of a bundle"""
1335 """lists the contents of a bundle"""
@@ -1524,129 +1380,68 b' def debugbundle(ui, bundlepath, all=None'
1524 finally:
1380 finally:
1525 f.close()
1381 f.close()
1526
1382
1527 @command('debuggetbundle',
1383 @command('debugcheckstate', [], '')
1528 [('H', 'head', [], _('id of head node'), _('ID')),
1384 def debugcheckstate(ui, repo):
1529 ('C', 'common', [], _('id of common node'), _('ID')),
1385 """validate the correctness of the current dirstate"""
1530 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
1386 parent1, parent2 = repo.dirstate.parents()
1531 _('REPO FILE [-H|-C ID]...'))
1387 m1 = repo[parent1].manifest()
1532 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
1388 m2 = repo[parent2].manifest()
1533 """retrieves a bundle from a repo
1389 errors = 0
1534
1390 for f in repo.dirstate:
1535 Every ID must be a full-length hex node id string. Saves the bundle to the
1391 state = repo.dirstate[f]
1536 given file.
1392 if state in "nr" and f not in m1:
1537 """
1393 ui.warn(_("%s in state %s, but not in manifest1\n") % (f, state))
1538 repo = hg.repository(ui, repopath)
1394 errors += 1
1539 if not repo.capable('getbundle'):
1395 if state in "a" and f in m1:
1540 raise util.Abort("getbundle() not supported by target repository")
1396 ui.warn(_("%s in state %s, but also in manifest1\n") % (f, state))
1541 args = {}
1397 errors += 1
1542 if common:
1398 if state in "m" and f not in m1 and f not in m2:
1543 args['common'] = [bin(s) for s in common]
1399 ui.warn(_("%s in state %s, but not in either manifest\n") %
1544 if head:
1400 (f, state))
1545 args['heads'] = [bin(s) for s in head]
1401 errors += 1
1546 bundle = repo.getbundle('debug', **args)
1402 for f in m1:
1547
1403 state = repo.dirstate[f]
1548 bundletype = opts.get('type', 'bzip2').lower()
1404 if state not in "nrm":
1549 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
1405 ui.warn(_("%s in manifest1, but listed as state %s") % (f, state))
1550 bundletype = btypes.get(bundletype)
1406 errors += 1
1551 if bundletype not in changegroup.bundletypes:
1407 if errors:
1552 raise util.Abort(_('unknown bundle type specified with --type'))
1408 error = _(".hg/dirstate inconsistent with current parent's manifest")
1553 changegroup.writebundle(bundle, bundlepath, bundletype)
1409 raise util.Abort(error)
1554
1410
1555 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
1411 @command('debugcommands', [], _('[COMMAND]'))
1556 def debugpushkey(ui, repopath, namespace, *keyinfo):
1412 def debugcommands(ui, cmd='', *args):
1557 '''access the pushkey key/value protocol
1413 """list all available commands and options"""
1558
1414 for cmd, vals in sorted(table.iteritems()):
1559 With two args, list the keys in the given namespace.
1415 cmd = cmd.split('|')[0].strip('^')
1560
1416 opts = ', '.join([i[1] for i in vals[1]])
1561 With five args, set a key to new if it currently is set to old.
1417 ui.write('%s: %s\n' % (cmd, opts))
1562 Reports success or failure.
1418
1563 '''
1419 @command('debugcomplete',
1564
1420 [('o', 'options', None, _('show the command options'))],
1565 target = hg.repository(ui, repopath)
1421 _('[-o] CMD'))
1566 if keyinfo:
1422 def debugcomplete(ui, cmd='', **opts):
1567 key, old, new = keyinfo
1423 """returns the completion list associated with the given command"""
1568 r = target.pushkey(namespace, key, old, new)
1424
1569 ui.status(str(r) + '\n')
1425 if opts.get('options'):
1570 return not r
1426 options = []
1571 else:
1427 otables = [globalopts]
1572 for k, v in target.listkeys(namespace).iteritems():
1428 if cmd:
1573 ui.write("%s\t%s\n" % (k.encode('string-escape'),
1429 aliases, entry = cmdutil.findcmd(cmd, table, False)
1574 v.encode('string-escape')))
1430 otables.append(entry[1])
1575
1431 for t in otables:
1576 @command('debugrevspec', [], ('REVSPEC'))
1432 for o in t:
1577 def debugrevspec(ui, repo, expr):
1433 if "(DEPRECATED)" in o[3]:
1578 '''parse and apply a revision specification'''
1434 continue
1435 if o[0]:
1436 options.append('-%s' % o[0])
1437 options.append('--%s' % o[1])
1438 ui.write("%s\n" % "\n".join(options))
1439 return
1440
1441 cmdlist = cmdutil.findpossible(cmd, table)
1579 if ui.verbose:
1442 if ui.verbose:
1580 tree = revset.parse(expr)[0]
1443 cmdlist = [' '.join(c[0]) for c in cmdlist.values()]
1581 ui.note(tree, "\n")
1444 ui.write("%s\n" % "\n".join(sorted(cmdlist)))
1582 newtree = revset.findaliases(ui, tree)
1583 if newtree != tree:
1584 ui.note(newtree, "\n")
1585 func = revset.match(ui, expr)
1586 for c in func(repo, range(len(repo))):
1587 ui.write("%s\n" % c)
1588
1589 @command('debugsetparents', [], _('REV1 [REV2]'))
1590 def debugsetparents(ui, repo, rev1, rev2=None):
1591 """manually set the parents of the current working directory
1592
1593 This is useful for writing repository conversion tools, but should
1594 be used with care.
1595
1596 Returns 0 on success.
1597 """
1598
1599 r1 = cmdutil.revsingle(repo, rev1).node()
1600 r2 = cmdutil.revsingle(repo, rev2, 'null').node()
1601
1602 wlock = repo.wlock()
1603 try:
1604 repo.dirstate.setparents(r1, r2)
1605 finally:
1606 wlock.release()
1607
1608 @command('debugstate',
1609 [('', 'nodates', None, _('do not display the saved mtime')),
1610 ('', 'datesort', None, _('sort by saved mtime'))],
1611 _('[OPTION]...'))
1612 def debugstate(ui, repo, nodates=None, datesort=None):
1613 """show the contents of the current dirstate"""
1614 timestr = ""
1615 showdate = not nodates
1616 if datesort:
1617 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
1618 else:
1619 keyfunc = None # sort by filename
1620 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
1621 if showdate:
1622 if ent[3] == -1:
1623 # Pad or slice to locale representation
1624 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ",
1625 time.localtime(0)))
1626 timestr = 'unset'
1627 timestr = (timestr[:locale_len] +
1628 ' ' * (locale_len - len(timestr)))
1629 else:
1630 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
1631 time.localtime(ent[3]))
1632 if ent[1] & 020000:
1633 mode = 'lnk'
1634 else:
1635 mode = '%3o' % (ent[1] & 0777)
1636 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
1637 for f in repo.dirstate.copies():
1638 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
1639
1640 @command('debugsub',
1641 [('r', 'rev', '',
1642 _('revision to check'), _('REV'))],
1643 _('[-r REV] [REV]'))
1644 def debugsub(ui, repo, rev=None):
1645 ctx = cmdutil.revsingle(repo, rev, None)
1646 for k, v in sorted(ctx.substate.items()):
1647 ui.write('path %s\n' % k)
1648 ui.write(' source %s\n' % v[0])
1649 ui.write(' revision %s\n' % v[1])
1650
1445
1651 @command('debugdag',
1446 @command('debugdag',
1652 [('t', 'tags', None, _('use tags as labels')),
1447 [('t', 'tags', None, _('use tags as labels')),
@@ -1738,15 +1533,6 b' def debugdate(ui, date, range=None, **op'
1738 m = util.matchdate(range)
1533 m = util.matchdate(range)
1739 ui.write("match: %s\n" % m(d[0]))
1534 ui.write("match: %s\n" % m(d[0]))
1740
1535
1741 @command('debugignore', [], '')
1742 def debugignore(ui, repo, *values, **opts):
1743 """display the combined ignore pattern"""
1744 ignore = repo.dirstate._ignore
1745 if hasattr(ignore, 'includepat'):
1746 ui.write("%s\n" % ignore.includepat)
1747 else:
1748 raise util.Abort(_("no ignore patterns found"))
1749
1750 @command('debugdiscovery',
1536 @command('debugdiscovery',
1751 [('', 'old', None, _('use old-style discovery')),
1537 [('', 'old', None, _('use old-style discovery')),
1752 ('', 'nonheads', None,
1538 ('', 'nonheads', None,
@@ -1811,6 +1597,53 b' def debugdiscovery(ui, repo, remoteurl="'
1811 localrevs = opts.get('local_head')
1597 localrevs = opts.get('local_head')
1812 doit(localrevs, remoterevs)
1598 doit(localrevs, remoterevs)
1813
1599
1600 @command('debugfsinfo', [], _('[PATH]'))
1601 def debugfsinfo(ui, path = "."):
1602 """show information detected about current filesystem"""
1603 util.writefile('.debugfsinfo', '')
1604 ui.write('exec: %s\n' % (util.checkexec(path) and 'yes' or 'no'))
1605 ui.write('symlink: %s\n' % (util.checklink(path) and 'yes' or 'no'))
1606 ui.write('case-sensitive: %s\n' % (util.checkcase('.debugfsinfo')
1607 and 'yes' or 'no'))
1608 os.unlink('.debugfsinfo')
1609
1610 @command('debuggetbundle',
1611 [('H', 'head', [], _('id of head node'), _('ID')),
1612 ('C', 'common', [], _('id of common node'), _('ID')),
1613 ('t', 'type', 'bzip2', _('bundle compression type to use'), _('TYPE'))],
1614 _('REPO FILE [-H|-C ID]...'))
1615 def debuggetbundle(ui, repopath, bundlepath, head=None, common=None, **opts):
1616 """retrieves a bundle from a repo
1617
1618 Every ID must be a full-length hex node id string. Saves the bundle to the
1619 given file.
1620 """
1621 repo = hg.repository(ui, repopath)
1622 if not repo.capable('getbundle'):
1623 raise util.Abort("getbundle() not supported by target repository")
1624 args = {}
1625 if common:
1626 args['common'] = [bin(s) for s in common]
1627 if head:
1628 args['heads'] = [bin(s) for s in head]
1629 bundle = repo.getbundle('debug', **args)
1630
1631 bundletype = opts.get('type', 'bzip2').lower()
1632 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
1633 bundletype = btypes.get(bundletype)
1634 if bundletype not in changegroup.bundletypes:
1635 raise util.Abort(_('unknown bundle type specified with --type'))
1636 changegroup.writebundle(bundle, bundlepath, bundletype)
1637
1638 @command('debugignore', [], '')
1639 def debugignore(ui, repo, *values, **opts):
1640 """display the combined ignore pattern"""
1641 ignore = repo.dirstate._ignore
1642 if hasattr(ignore, 'includepat'):
1643 ui.write("%s\n" % ignore.includepat)
1644 else:
1645 raise util.Abort(_("no ignore patterns found"))
1646
1814 @command('debugindex',
1647 @command('debugindex',
1815 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1648 [('f', 'format', 0, _('revlog format'), _('FORMAT'))],
1816 _('FILE'))
1649 _('FILE'))
@@ -1959,6 +1792,52 b' def debuginstall(ui):'
1959
1792
1960 return problems
1793 return problems
1961
1794
1795 @command('debugknown', [], _('REPO ID...'))
1796 def debugknown(ui, repopath, *ids, **opts):
1797 """test whether node ids are known to a repo
1798
1799 Every ID must be a full-length hex node id string. Returns a list of 0s and 1s
1800 indicating unknown/known.
1801 """
1802 repo = hg.repository(ui, repopath)
1803 if not repo.capable('known'):
1804 raise util.Abort("known() not supported by target repository")
1805 flags = repo.known([bin(s) for s in ids])
1806 ui.write("%s\n" % ("".join([f and "1" or "0" for f in flags])))
1807
1808 @command('debugpushkey', [], _('REPO NAMESPACE [KEY OLD NEW]'))
1809 def debugpushkey(ui, repopath, namespace, *keyinfo):
1810 '''access the pushkey key/value protocol
1811
1812 With two args, list the keys in the given namespace.
1813
1814 With five args, set a key to new if it currently is set to old.
1815 Reports success or failure.
1816 '''
1817
1818 target = hg.repository(ui, repopath)
1819 if keyinfo:
1820 key, old, new = keyinfo
1821 r = target.pushkey(namespace, key, old, new)
1822 ui.status(str(r) + '\n')
1823 return not r
1824 else:
1825 for k, v in target.listkeys(namespace).iteritems():
1826 ui.write("%s\t%s\n" % (k.encode('string-escape'),
1827 v.encode('string-escape')))
1828
1829 @command('debugrebuildstate',
1830 [('r', 'rev', '', _('revision to rebuild to'), _('REV'))],
1831 _('[-r REV] [REV]'))
1832 def debugrebuildstate(ui, repo, rev="tip"):
1833 """rebuild the dirstate as it would look like for the given revision"""
1834 ctx = cmdutil.revsingle(repo, rev)
1835 wlock = repo.wlock()
1836 try:
1837 repo.dirstate.rebuild(ctx.node(), ctx.manifest())
1838 finally:
1839 wlock.release()
1840
1962 @command('debugrename',
1841 @command('debugrename',
1963 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1842 [('r', 'rev', '', _('revision to debug'), _('REV'))],
1964 _('[-r REV] FILE'))
1843 _('[-r REV] FILE'))
@@ -1976,6 +1855,81 b' def debugrename(ui, repo, file1, *pats, '
1976 else:
1855 else:
1977 ui.write(_("%s not renamed\n") % rel)
1856 ui.write(_("%s not renamed\n") % rel)
1978
1857
1858 @command('debugrevspec', [], ('REVSPEC'))
1859 def debugrevspec(ui, repo, expr):
1860 '''parse and apply a revision specification'''
1861 if ui.verbose:
1862 tree = revset.parse(expr)[0]
1863 ui.note(tree, "\n")
1864 newtree = revset.findaliases(ui, tree)
1865 if newtree != tree:
1866 ui.note(newtree, "\n")
1867 func = revset.match(ui, expr)
1868 for c in func(repo, range(len(repo))):
1869 ui.write("%s\n" % c)
1870
1871 @command('debugsetparents', [], _('REV1 [REV2]'))
1872 def debugsetparents(ui, repo, rev1, rev2=None):
1873 """manually set the parents of the current working directory
1874
1875 This is useful for writing repository conversion tools, but should
1876 be used with care.
1877
1878 Returns 0 on success.
1879 """
1880
1881 r1 = cmdutil.revsingle(repo, rev1).node()
1882 r2 = cmdutil.revsingle(repo, rev2, 'null').node()
1883
1884 wlock = repo.wlock()
1885 try:
1886 repo.dirstate.setparents(r1, r2)
1887 finally:
1888 wlock.release()
1889
1890 @command('debugstate',
1891 [('', 'nodates', None, _('do not display the saved mtime')),
1892 ('', 'datesort', None, _('sort by saved mtime'))],
1893 _('[OPTION]...'))
1894 def debugstate(ui, repo, nodates=None, datesort=None):
1895 """show the contents of the current dirstate"""
1896 timestr = ""
1897 showdate = not nodates
1898 if datesort:
1899 keyfunc = lambda x: (x[1][3], x[0]) # sort by mtime, then by filename
1900 else:
1901 keyfunc = None # sort by filename
1902 for file_, ent in sorted(repo.dirstate._map.iteritems(), key=keyfunc):
1903 if showdate:
1904 if ent[3] == -1:
1905 # Pad or slice to locale representation
1906 locale_len = len(time.strftime("%Y-%m-%d %H:%M:%S ",
1907 time.localtime(0)))
1908 timestr = 'unset'
1909 timestr = (timestr[:locale_len] +
1910 ' ' * (locale_len - len(timestr)))
1911 else:
1912 timestr = time.strftime("%Y-%m-%d %H:%M:%S ",
1913 time.localtime(ent[3]))
1914 if ent[1] & 020000:
1915 mode = 'lnk'
1916 else:
1917 mode = '%3o' % (ent[1] & 0777)
1918 ui.write("%c %s %10d %s%s\n" % (ent[0], mode, ent[2], timestr, file_))
1919 for f in repo.dirstate.copies():
1920 ui.write(_("copy: %s -> %s\n") % (repo.dirstate.copied(f), f))
1921
1922 @command('debugsub',
1923 [('r', 'rev', '',
1924 _('revision to check'), _('REV'))],
1925 _('[-r REV] [REV]'))
1926 def debugsub(ui, repo, rev=None):
1927 ctx = cmdutil.revsingle(repo, rev, None)
1928 for k, v in sorted(ctx.substate.items()):
1929 ui.write('path %s\n' % k)
1930 ui.write(' source %s\n' % v[0])
1931 ui.write(' revision %s\n' % v[1])
1932
1979 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'))
1933 @command('debugwalk', walkopts, _('[OPTION]... [FILE]...'))
1980 def debugwalk(ui, repo, *pats, **opts):
1934 def debugwalk(ui, repo, *pats, **opts):
1981 """show how files match on given patterns"""
1935 """show how files match on given patterns"""
@@ -4321,6 +4275,52 b' def serve(ui, repo, **opts):'
4321
4275
4322 cmdutil.service(opts, initfn=service.init, runfn=service.run)
4276 cmdutil.service(opts, initfn=service.init, runfn=service.run)
4323
4277
4278 @command('showconfig|debugconfig',
4279 [('u', 'untrusted', None, _('show untrusted configuration options'))],
4280 _('[-u] [NAME]...'))
4281 def showconfig(ui, repo, *values, **opts):
4282 """show combined config settings from all hgrc files
4283
4284 With no arguments, print names and values of all config items.
4285
4286 With one argument of the form section.name, print just the value
4287 of that config item.
4288
4289 With multiple arguments, print names and values of all config
4290 items with matching section names.
4291
4292 With --debug, the source (filename and line number) is printed
4293 for each config item.
4294
4295 Returns 0 on success.
4296 """
4297
4298 for f in scmutil.rcpath():
4299 ui.debug(_('read config from: %s\n') % f)
4300 untrusted = bool(opts.get('untrusted'))
4301 if values:
4302 sections = [v for v in values if '.' not in v]
4303 items = [v for v in values if '.' in v]
4304 if len(items) > 1 or items and sections:
4305 raise util.Abort(_('only one config item permitted'))
4306 for section, name, value in ui.walkconfig(untrusted=untrusted):
4307 value = str(value).replace('\n', '\\n')
4308 sectname = section + '.' + name
4309 if values:
4310 for v in values:
4311 if v == section:
4312 ui.debug('%s: ' %
4313 ui.configsource(section, name, untrusted))
4314 ui.write('%s=%s\n' % (sectname, value))
4315 elif v == sectname:
4316 ui.debug('%s: ' %
4317 ui.configsource(section, name, untrusted))
4318 ui.write(value, '\n')
4319 else:
4320 ui.debug('%s: ' %
4321 ui.configsource(section, name, untrusted))
4322 ui.write('%s=%s\n' % (sectname, value))
4323
4324 @command('^status|st',
4324 @command('^status|st',
4325 [('A', 'all', None, _('show status of all files')),
4325 [('A', 'all', None, _('show status of all files')),
4326 ('m', 'modified', None, _('show only modified files')),
4326 ('m', 'modified', None, _('show only modified files')),
General Comments 0
You need to be logged in to leave comments. Login now