mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
dispatch: only do __import__(debugger) when a debugger is requested
When having ui.debugger=somedebugger in one's ~/.hgrc, this then somedebugger would be imported for every hg command. With this patch, this import only happens if the --debugger parameter is passed.
This commit is contained in:
parent
c52b73121a
commit
4d640be53b
@ -108,13 +108,17 @@ def _runcatch(req):
|
|||||||
|
|
||||||
# if we are in HGPLAIN mode, then disable custom debugging
|
# if we are in HGPLAIN mode, then disable custom debugging
|
||||||
debugger = ui.config("ui", "debugger")
|
debugger = ui.config("ui", "debugger")
|
||||||
|
debugmod = pdb
|
||||||
if not debugger or ui.plain():
|
if not debugger or ui.plain():
|
||||||
debugger = 'pdb'
|
debugger = 'pdb'
|
||||||
|
elif '--debugger' in req.args:
|
||||||
try:
|
# This import can be slow for fancy debuggers, so only
|
||||||
debugmod = __import__(debugger)
|
# do it when absolutely necessary, i.e. when actual
|
||||||
except ImportError:
|
# debugging has been requested
|
||||||
debugmod = pdb
|
try:
|
||||||
|
debugmod = __import__(debugger)
|
||||||
|
except ImportError:
|
||||||
|
pass # Leave debugmod = pdb
|
||||||
|
|
||||||
debugtrace[debugger] = debugmod.set_trace
|
debugtrace[debugger] = debugmod.set_trace
|
||||||
debugmortem[debugger] = debugmod.post_mortem
|
debugmortem[debugger] = debugmod.post_mortem
|
||||||
|
Loading…
Reference in New Issue
Block a user