##// END OF EJS Templates
add ui.print_exc(), make all traceback printing central.
Vadim Gelfer -
r2335:f0680b2d default
parent child Browse files
Show More
@@ -3299,10 +3299,8 b' def dispatch(args):'
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)
@@ -3398,8 +3396,7 b' def dispatch(args):'
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]:
@@ -12,7 +12,7 b' from i18n import gettext as _'
12 from demandload import *
12 from demandload import *
13 demandload(globals(), "appendfile changegroup")
13 demandload(globals(), "appendfile changegroup")
14 demandload(globals(), "re lock transaction tempfile stat mdiff errno ui")
14 demandload(globals(), "re lock transaction tempfile stat mdiff errno ui")
15 demandload(globals(), "revlog traceback")
15 demandload(globals(), "revlog")
16
16
17 class localrepository(object):
17 class localrepository(object):
18 def __del__(self):
18 def __del__(self):
@@ -125,8 +125,7 b' class localrepository(object):'
125 '%s\n') % (hname, exc))
125 '%s\n') % (hname, exc))
126 if throw:
126 if throw:
127 raise
127 raise
128 if self.ui.traceback:
128 self.ui.print_exc()
129 traceback.print_exc()
130 return True
129 return True
131 if r:
130 if r:
132 if throw:
131 if throw:
@@ -9,7 +9,7 b' import ConfigParser'
9 from i18n import gettext as _
9 from i18n import gettext as _
10 from demandload import *
10 from demandload import *
11 demandload(globals(), "errno getpass os re smtplib socket sys tempfile")
11 demandload(globals(), "errno getpass os re smtplib socket sys tempfile")
12 demandload(globals(), "templater util")
12 demandload(globals(), "templater traceback util")
13
13
14 class ui(object):
14 class ui(object):
15 def __init__(self, verbose=False, debug=False, quiet=False,
15 def __init__(self, verbose=False, debug=False, quiet=False,
@@ -335,3 +335,11 b' class ui(object):'
335 else:
335 else:
336 mail = sendmail(self, method)
336 mail = sendmail(self, method)
337 return mail
337 return mail
338
339 def print_exc(self):
340 '''print exception traceback if traceback printing enabled.
341 only to call in exception handler. returns true if traceback
342 printed.'''
343 if self.traceback:
344 traceback.print_exc()
345 return self.traceback
General Comments 0
You need to be logged in to leave comments. Login now