comparison mercurial/commands.py @ 2166:d0c02b4dce9a

do not check sys.argv from localrepo when running hooks. instead add traceback field to ui class.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Sun, 30 Apr 2006 16:30:39 -0700
parents 858df1f354c1
children f5c2c6e69fd7
comparison
equal deleted inserted replaced
2164:cbd458228a96 2166:d0c02b4dce9a
3363 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM': 3363 for name in 'SIGBREAK', 'SIGHUP', 'SIGTERM':
3364 num = getattr(signal, name, None) 3364 num = getattr(signal, name, None)
3365 if num: signal.signal(num, catchterm) 3365 if num: signal.signal(num, catchterm)
3366 3366
3367 try: 3367 try:
3368 u = ui.ui() 3368 u = ui.ui(traceback='--traceback' in sys.argv[1:])
3369 except util.Abort, inst: 3369 except util.Abort, inst:
3370 sys.stderr.write(_("abort: %s\n") % inst) 3370 sys.stderr.write(_("abort: %s\n") % inst)
3371 return -1 3371 return -1
3372 3372
3373 external = [] 3373 external = []
3387 except ImportError: 3387 except ImportError:
3388 mod = importh(x[0]) 3388 mod = importh(x[0])
3389 external.append(mod) 3389 external.append(mod)
3390 except Exception, inst: 3390 except Exception, inst:
3391 u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) 3391 u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst))
3392 if "--traceback" in sys.argv[1:]: 3392 if u.traceback:
3393 traceback.print_exc() 3393 traceback.print_exc()
3394 return 1 3394 return 1
3395 continue 3395 continue
3396 3396
3397 for x in external: 3397 for x in external:
3415 u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") % 3415 u.warn(_("Time: real %.3f secs (user %.3f+%.3f sys %.3f+%.3f)\n") %
3416 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3])) 3416 (t[4]-s[4], t[0]-s[0], t[2]-s[2], t[1]-s[1], t[3]-s[3]))
3417 atexit.register(print_time) 3417 atexit.register(print_time)
3418 3418
3419 u.updateopts(options["verbose"], options["debug"], options["quiet"], 3419 u.updateopts(options["verbose"], options["debug"], options["quiet"],
3420 not options["noninteractive"]) 3420 not options["noninteractive"], options["traceback"])
3421 3421
3422 # enter the debugger before command execution 3422 # enter the debugger before command execution
3423 if options['debugger']: 3423 if options['debugger']:
3424 pdb.set_trace() 3424 pdb.set_trace()
3425 3425
3482 u.flush() 3482 u.flush()
3483 except: 3483 except:
3484 # enter the debugger when we hit an exception 3484 # enter the debugger when we hit an exception
3485 if options['debugger']: 3485 if options['debugger']:
3486 pdb.post_mortem(sys.exc_info()[2]) 3486 pdb.post_mortem(sys.exc_info()[2])
3487 if options['traceback']: 3487 if u.traceback:
3488 traceback.print_exc() 3488 traceback.print_exc()
3489 raise 3489 raise
3490 except ParseError, inst: 3490 except ParseError, inst:
3491 if inst.args[0]: 3491 if inst.args[0]:
3492 u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) 3492 u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))