comparison mercurial/localrepo.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 dbdce3b99988
children 11422943cf72
comparison
equal deleted inserted replaced
2334:737deea2442c 2335:f0680b2d1d64
10 from node import * 10 from node import *
11 from i18n import gettext as _ 11 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):
19 self.transhandle = None 19 self.transhandle = None
20 def __init__(self, parentui, path=None, create=0): 20 def __init__(self, parentui, path=None, create=0):
123 else: 123 else:
124 self.ui.warn(_('error: %s hook raised an exception: ' 124 self.ui.warn(_('error: %s hook raised an exception: '
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:
133 raise util.Abort(_('%s hook failed') % hname) 132 raise util.Abort(_('%s hook failed') % hname)
134 self.ui.warn(_('warning: %s hook failed\n') % hname) 133 self.ui.warn(_('warning: %s hook failed\n') % hname)