##// END OF EJS Templates
dispatch: have dispatch.dispatch and dispatch._runcatch emit trace events...
Augie Fackler -
r39291:4019b454 default
parent child Browse files
Show More
@@ -21,6 +21,8 b' import traceback'
21
21
22 from .i18n import _
22 from .i18n import _
23
23
24 from hgdemandimport import tracing
25
24 from . import (
26 from . import (
25 cmdutil,
27 cmdutil,
26 color,
28 color,
@@ -84,6 +86,7 b' class request(object):'
84 def run():
86 def run():
85 "run the command in sys.argv"
87 "run the command in sys.argv"
86 initstdio()
88 initstdio()
89 with tracing.log('parse args into request'):
87 req = request(pycompat.sysargv[1:])
90 req = request(pycompat.sysargv[1:])
88 err = None
91 err = None
89 try:
92 try:
@@ -176,6 +179,7 b' def _formatargs(args):'
176
179
177 def dispatch(req):
180 def dispatch(req):
178 """run the command specified in req.args; returns an integer status code"""
181 """run the command specified in req.args; returns an integer status code"""
182 with tracing.log('dispatch.dispatch'):
179 if req.ferr:
183 if req.ferr:
180 ferr = req.ferr
184 ferr = req.ferr
181 elif req.ui:
185 elif req.ui:
@@ -247,6 +251,7 b' def dispatch(req):'
247 return ret
251 return ret
248
252
249 def _runcatch(req):
253 def _runcatch(req):
254 with tracing.log('dispatch._runcatch'):
250 def catchterm(*args):
255 def catchterm(*args):
251 raise error.SignalInterrupt
256 raise error.SignalInterrupt
252
257
@@ -262,7 +267,8 b' def _runcatch(req):'
262 def _runcatchfunc():
267 def _runcatchfunc():
263 realcmd = None
268 realcmd = None
264 try:
269 try:
265 cmdargs = fancyopts.fancyopts(req.args[:], commands.globalopts, {})
270 cmdargs = fancyopts.fancyopts(
271 req.args[:], commands.globalopts, {})
266 cmd = cmdargs[0]
272 cmd = cmdargs[0]
267 aliases, entry = cmdutil.findcmd(cmd, commands.table, False)
273 aliases, entry = cmdutil.findcmd(cmd, commands.table, False)
268 realcmd = aliases[0]
274 realcmd = aliases[0]
@@ -350,7 +356,6 b' def _runcatch(req):'
350 traceback.print_exc()
356 traceback.print_exc()
351 debugmortem[debugger](sys.exc_info()[2])
357 debugmortem[debugger](sys.exc_info()[2])
352 raise
358 raise
353
354 return _callcatch(ui, _runcatchfunc)
359 return _callcatch(ui, _runcatchfunc)
355
360
356 def _callcatch(ui, func):
361 def _callcatch(ui, func):
General Comments 0
You need to be logged in to leave comments. Login now