Mercurial > hg
comparison mercurial/commands.py @ 4954:90be978c9d3d
merge with crew-stable
author | Alexis S. L. Carvalho <alexis@cecm.usp.br> |
---|---|
date | Thu, 19 Jul 2007 19:48:24 -0300 |
parents | 53a1847a99d1 93b7e2fa7ee3 |
children | 02b127749dc0 |
comparison
equal
deleted
inserted
replaced
4949:2f0f9528e77b | 4954:90be978c9d3d |
---|---|
1353 if i[1]: | 1353 if i[1]: |
1354 option_lists.append((_("options:\n"), i[1])) | 1354 option_lists.append((_("options:\n"), i[1])) |
1355 | 1355 |
1356 addglobalopts(False) | 1356 addglobalopts(False) |
1357 | 1357 |
1358 def helplist(select=None): | 1358 def helplist(header, select=None): |
1359 h = {} | 1359 h = {} |
1360 cmds = {} | 1360 cmds = {} |
1361 for c, e in table.items(): | 1361 for c, e in table.items(): |
1362 f = c.split("|", 1)[0] | 1362 f = c.split("|", 1)[0] |
1363 if select and not select(f): | 1363 if select and not select(f): |
1371 if not doc: | 1371 if not doc: |
1372 doc = _("(No help text available)") | 1372 doc = _("(No help text available)") |
1373 h[f] = doc.splitlines(0)[0].rstrip() | 1373 h[f] = doc.splitlines(0)[0].rstrip() |
1374 cmds[f] = c.lstrip("^") | 1374 cmds[f] = c.lstrip("^") |
1375 | 1375 |
1376 if not h: | |
1377 ui.status(_('no commands defined\n')) | |
1378 return | |
1379 | |
1380 ui.status(header) | |
1376 fns = h.keys() | 1381 fns = h.keys() |
1377 fns.sort() | 1382 fns.sort() |
1378 m = max(map(len, fns)) | 1383 m = max(map(len, fns)) |
1379 for f in fns: | 1384 for f in fns: |
1380 if ui.verbose: | 1385 if ui.verbose: |
1420 ui.status('\n') | 1425 ui.status('\n') |
1421 | 1426 |
1422 try: | 1427 try: |
1423 ct = mod.cmdtable | 1428 ct = mod.cmdtable |
1424 except AttributeError: | 1429 except AttributeError: |
1425 ct = None | 1430 ct = {} |
1426 if not ct: | 1431 |
1427 ui.status(_('no commands defined\n')) | |
1428 return | |
1429 | |
1430 ui.status(_('list of commands:\n\n')) | |
1431 modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct]) | 1432 modcmds = dict.fromkeys([c.split('|', 1)[0] for c in ct]) |
1432 helplist(modcmds.has_key) | 1433 helplist(_('list of commands:\n\n'), modcmds.has_key) |
1433 | 1434 |
1434 if name and name != 'shortlist': | 1435 if name and name != 'shortlist': |
1435 i = None | 1436 i = None |
1436 for f in (helpcmd, helptopic, helpext): | 1437 for f in (helpcmd, helptopic, helpext): |
1437 try: | 1438 try: |
1451 ui.status(_("Mercurial Distributed SCM\n")) | 1452 ui.status(_("Mercurial Distributed SCM\n")) |
1452 ui.status('\n') | 1453 ui.status('\n') |
1453 | 1454 |
1454 # list of commands | 1455 # list of commands |
1455 if name == "shortlist": | 1456 if name == "shortlist": |
1456 ui.status(_('basic commands:\n\n')) | 1457 header = _('basic commands:\n\n') |
1457 else: | 1458 else: |
1458 ui.status(_('list of commands:\n\n')) | 1459 header = _('list of commands:\n\n') |
1459 | 1460 |
1460 helplist() | 1461 helplist(header) |
1461 | 1462 |
1462 # list all option lists | 1463 # list all option lists |
1463 opt_output = [] | 1464 opt_output = [] |
1464 for title, options in option_lists: | 1465 for title, options in option_lists: |
1465 opt_output.append(("\n%s" % title, None)) | 1466 opt_output.append(("\n%s" % title, None)) |