comparison mercurial/commands.py @ 2335:f0680b2d1d64

add ui.print_exc(), make all traceback printing central.
author Vadim Gelfer <vadim.gelfer@gmail.com>
date Mon, 22 May 2006 08:47:53 -0700
parents 953dbfb2824c
children eb08fb4d41e1
comparison
equal deleted inserted replaced
2334:737deea2442c 2335:f0680b2d1d64
3297 except ImportError: 3297 except ImportError:
3298 mod = importh(x[0]) 3298 mod = importh(x[0])
3299 external.append(mod) 3299 external.append(mod)
3300 except Exception, inst: 3300 except Exception, inst:
3301 u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst)) 3301 u.warn(_("*** failed to import extension %s: %s\n") % (x[0], inst))
3302 if u.traceback: 3302 if u.print_exc():
3303 traceback.print_exc()
3304 return 1 3303 return 1
3305 continue
3306 3304
3307 for x in external: 3305 for x in external:
3308 uisetup = getattr(x, 'uisetup', None) 3306 uisetup = getattr(x, 'uisetup', None)
3309 if uisetup: 3307 if uisetup:
3310 uisetup(u) 3308 uisetup(u)
3396 u.flush() 3394 u.flush()
3397 except: 3395 except:
3398 # enter the debugger when we hit an exception 3396 # enter the debugger when we hit an exception
3399 if options['debugger']: 3397 if options['debugger']:
3400 pdb.post_mortem(sys.exc_info()[2]) 3398 pdb.post_mortem(sys.exc_info()[2])
3401 if u.traceback: 3399 u.print_exc()
3402 traceback.print_exc()
3403 raise 3400 raise
3404 except ParseError, inst: 3401 except ParseError, inst:
3405 if inst.args[0]: 3402 if inst.args[0]:
3406 u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1])) 3403 u.warn(_("hg %s: %s\n") % (inst.args[0], inst.args[1]))
3407 help_(u, inst.args[0]) 3404 help_(u, inst.args[0])