equal
deleted
inserted
replaced
285 ) |
285 ) |
286 |
286 |
287 def help_(ui, cmd=None): |
287 def help_(ui, cmd=None): |
288 """show help for a given command or all commands""" |
288 """show help for a given command or all commands""" |
289 if cmd and cmd != 'shortlist': |
289 if cmd and cmd != 'shortlist': |
290 try: |
290 i = find(cmd) |
291 i = find(cmd) |
291 ui.write("%s\n\n" % i[2]) |
292 ui.write("%s\n\n" % i[2]) |
292 |
293 |
293 if i[1]: |
294 if i[1]: |
294 for s, l, d, c in i[1]: |
295 for s, l, d, c in i[1]: |
295 opt = ' ' |
296 opt = ' ' |
296 if s: |
297 if s: |
297 opt = opt + '-' + s + ' ' |
298 opt = opt + '-' + s + ' ' |
298 if l: |
299 if l: |
299 opt = opt + '--' + l + ' ' |
300 opt = opt + '--' + l + ' ' |
300 if d: |
301 if d: |
301 opt = opt + '(' + str(d) + ')' |
302 opt = opt + '(' + str(d) + ')' |
302 ui.write(opt, "\n") |
303 ui.write(opt, "\n") |
303 if c: |
304 if c: |
304 ui.write(' %s\n' % c) |
305 ui.write(' %s\n' % c) |
305 ui.write("\n") |
306 ui.write("\n") |
306 |
307 |
307 ui.write(i[0].__doc__, "\n") |
308 ui.write(i[0].__doc__, "\n") |
|
309 except UnknownCommand: |
|
310 ui.warn("hg: unknown command %s\n" % cmd) |
|
311 sys.exit(0) |
308 sys.exit(0) |
312 else: |
309 else: |
313 if ui.verbose: |
310 if ui.verbose: |
314 show_version(ui) |
311 show_version(ui) |
315 ui.write('\n') |
312 ui.write('\n') |
1399 if inst.args[0]: |
1396 if inst.args[0]: |
1400 u.warn("hg %s: %s\n" % (inst.args[0], inst.args[1])) |
1397 u.warn("hg %s: %s\n" % (inst.args[0], inst.args[1])) |
1401 help_(u, inst.args[0]) |
1398 help_(u, inst.args[0]) |
1402 else: |
1399 else: |
1403 u.warn("hg: %s\n" % inst.args[1]) |
1400 u.warn("hg: %s\n" % inst.args[1]) |
1404 help_(u) |
1401 help_(u, 'shortlist') |
1405 sys.exit(-1) |
1402 sys.exit(-1) |
1406 except UnknownCommand, inst: |
1403 except UnknownCommand, inst: |
1407 u = ui.ui() |
1404 u = ui.ui() |
1408 u.warn("hg: unknown command '%s'\n" % inst.args[0]) |
1405 u.warn("hg: unknown command '%s'\n" % inst.args[0]) |
1409 help_(u) |
1406 help_(u, 'shortlist') |
1410 sys.exit(1) |
1407 sys.exit(1) |
1411 |
1408 |
1412 if options["time"]: |
1409 if options["time"]: |
1413 def get_times(): |
1410 def get_times(): |
1414 t = os.times() |
1411 t = os.times() |
1489 if len(tb) > 2: # no |
1486 if len(tb) > 2: # no |
1490 raise |
1487 raise |
1491 u.debug(inst, "\n") |
1488 u.debug(inst, "\n") |
1492 u.warn("%s: invalid arguments\n" % cmd) |
1489 u.warn("%s: invalid arguments\n" % cmd) |
1493 help_(u, cmd) |
1490 help_(u, cmd) |
|
1491 except UnknownCommand, inst: |
|
1492 u.warn("hg: unknown command '%s'\n" % inst.args[0]) |
|
1493 help_(u, 'shortlist') |
1494 |
1494 |
1495 sys.exit(-1) |
1495 sys.exit(-1) |