Show More
@@ -88,6 +88,13 b' def _runcatch(req):' | |||
|
88 | 88 | |
|
89 | 89 | try: |
|
90 | 90 | try: |
|
91 | debugger = 'pdb' | |
|
92 | debugtrace = { | |
|
93 | 'pdb' : pdb.set_trace | |
|
94 | } | |
|
95 | debugmortem = { | |
|
96 | 'pdb' : pdb.post_mortem | |
|
97 | } | |
|
91 | 98 | |
|
92 | 99 | # read --config before doing anything else |
|
93 | 100 | # (e.g. to change trust settings for reading .hg/hgrc) |
@@ -99,11 +106,29 b' def _runcatch(req):' | |||
|
99 | 106 | for cfg in cfgs: |
|
100 | 107 | req.repo.ui.setconfig(*cfg) |
|
101 | 108 | |
|
109 | debugger = ui.config("ui", "debugger") | |
|
110 | if not debugger: | |
|
111 | debugger = 'pdb' | |
|
112 | ||
|
113 | try: | |
|
114 | debugmod = __import__(debugger) | |
|
115 | except ImportError: | |
|
116 | debugmod = pdb | |
|
117 | ||
|
118 | debugtrace[debugger] = debugmod.set_trace | |
|
119 | debugmortem[debugger] = debugmod.post_mortem | |
|
120 | ||
|
102 | 121 | # enter the debugger before command execution |
|
103 | 122 | if '--debugger' in req.args: |
|
104 | 123 | ui.warn(_("entering debugger - " |
|
105 | 124 | "type c to continue starting hg or h for help\n")) |
|
106 | pdb.set_trace() | |
|
125 | ||
|
126 | if (debugger != 'pdb' and | |
|
127 | debugtrace[debugger] == debugtrace['pdb']): | |
|
128 | ui.warn(_("%s debugger specified " | |
|
129 | "but its module was not found\n") % debugger) | |
|
130 | ||
|
131 | debugtrace[debugger]() | |
|
107 | 132 | try: |
|
108 | 133 | return _dispatch(req) |
|
109 | 134 | finally: |
@@ -112,7 +137,7 b' def _runcatch(req):' | |||
|
112 | 137 | # enter the debugger when we hit an exception |
|
113 | 138 | if '--debugger' in req.args: |
|
114 | 139 | traceback.print_exc() |
|
115 |
|
|
|
140 | debugmortem[debugger](sys.exc_info()[2]) | |
|
116 | 141 | ui.traceback() |
|
117 | 142 | raise |
|
118 | 143 |
General Comments 0
You need to be logged in to leave comments.
Login now