comparison mercurial/commands.py @ 7643:9a1ea6587557

error: move UnknownCommand and AmbiguousCommand
author Matt Mackall <mpm@selenic.com>
date Mon, 12 Jan 2009 11:39:38 -0600
parents 1d54e2f6c0b7
children cce37dab7ad6
comparison
equal deleted inserted replaced
7642:84346894def8 7643:9a1ea6587557
1319 version_(ui) 1319 version_(ui)
1320 ui.write('\n') 1320 ui.write('\n')
1321 1321
1322 try: 1322 try:
1323 aliases, i = cmdutil.findcmd(name, table, False) 1323 aliases, i = cmdutil.findcmd(name, table, False)
1324 except cmdutil.AmbiguousCommand, inst: 1324 except error.AmbiguousCommand, inst:
1325 select = lambda c: c.lstrip('^').startswith(inst.args[0]) 1325 select = lambda c: c.lstrip('^').startswith(inst.args[0])
1326 helplist(_('list of commands:\n\n'), select) 1326 helplist(_('list of commands:\n\n'), select)
1327 return 1327 return
1328 1328
1329 # synopsis 1329 # synopsis
1408 def helptopic(name): 1408 def helptopic(name):
1409 for names, header, doc in help.helptable: 1409 for names, header, doc in help.helptable:
1410 if name in names: 1410 if name in names:
1411 break 1411 break
1412 else: 1412 else:
1413 raise cmdutil.UnknownCommand(name) 1413 raise error.UnknownCommand(name)
1414 1414
1415 # description 1415 # description
1416 if not doc: 1416 if not doc:
1417 doc = _("(no help text available)") 1417 doc = _("(no help text available)")
1418 if callable(doc): 1418 if callable(doc):
1423 1423
1424 def helpext(name): 1424 def helpext(name):
1425 try: 1425 try:
1426 mod = extensions.find(name) 1426 mod = extensions.find(name)
1427 except KeyError: 1427 except KeyError:
1428 raise cmdutil.UnknownCommand(name) 1428 raise error.UnknownCommand(name)
1429 1429
1430 doc = gettext(mod.__doc__) or _('no help text available') 1430 doc = gettext(mod.__doc__) or _('no help text available')
1431 doc = doc.splitlines(0) 1431 doc = doc.splitlines(0)
1432 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0])) 1432 ui.write(_('%s extension - %s\n') % (name.split('.')[-1], doc[0]))
1433 for d in doc[1:]: 1433 for d in doc[1:]:
1448 for f in (helptopic, helpcmd, helpext): 1448 for f in (helptopic, helpcmd, helpext):
1449 try: 1449 try:
1450 f(name) 1450 f(name)
1451 i = None 1451 i = None
1452 break 1452 break
1453 except cmdutil.UnknownCommand, inst: 1453 except error.UnknownCommand, inst:
1454 i = inst 1454 i = inst
1455 if i: 1455 if i:
1456 raise i 1456 raise i
1457 1457
1458 else: 1458 else: