Issue21

Title cannot debug extension
Priority bug Status resolved
Superseder Nosy List bos, mpm, tonfa, vadim
Assigned To vadim Topics

Created on 2005-10-21.04:47:12 by vadim, last changed 2005-11-04.23:19:54 by vadim.

Files
File name Uploaded Type Edit Remove
ext_traceback.diff tonfa, 2005-10-22.19:40:32 text/x-patch
Messages
msg140 (view) Author: bos Date: 2005-11-04.23:17:40
this is working for me, thank you.
msg39 (view) Author: mpm Date: 2005-10-24.22:23:17
Fix has been pushed.
msg27 (view) Author: mpm Date: 2005-10-23.01:04:56
On Sat, Oct 22, 2005 at 07:40:32PM +0000, Benoit Boissinot wrote:
> 
> Benoit Boissinot <bboissin@gmail.com> added the comment:
> 
> The following patch should work.

Queued, thanks.
msg26 (view) Author: tonfa Date: 2005-10-22.19:40:32
The following patch should work.
msg19 (view) Author: mpm Date: 2005-10-21.16:39:13
It'd be better to a) search argv for "--traceback" and b) use except Exception,
inst to actually show the exception in the normal case.
msg13 (view) Author: vadim Date: 2005-10-21.04:52:38
this patch is working for me. it would be nice to use --traceback instead. but
that parse call happens after that extension init stuffs, so i cannot. maybe
even though this is ugly, it is ok for extension writers.

diff -r 67779d34cb52 mercurial/commands.py
--- a/mercurial/commands.py	Sat Oct 15 15:49:05 2005 -0700
+++ b/mercurial/commands.py	Thu Oct 20 21:52:33 2005 -0700
@@ -2063,6 +2063,8 @@
                 mod = imp.load_source(x[0], x[1])
             except:
                 u.warn("*** failed to import extension %s\n" % x[1])
+                if os.getenv('HGEXT_TRACEBACK'):
+                    traceback.print_exc()
                 continue
         else:
             def importh(name):
@@ -2074,7 +2076,9 @@
             try:
                 mod = importh(x[0])
             except:
-                u.warn("failed to import extension %s\n" % x[0])
+                u.warn("*** failed to import extension %s\n" % x[0])
+                if os.getenv('HGEXT_TRACEBACK'):
+                    traceback.print_exc()
                 continue
 
         external.append(mod)
msg12 (view) Author: vadim Date: 2005-10-21.04:47:12
if i install an extension that has a syntax error, mercurial prints an import
error. i can not find out how to get it to tell me what went wrong. i tried
--traceback, it didnt work.
History
Date User Action Args
2005-11-04 23:19:54vadimsetnosy: + bos
2005-11-04 23:17:40bossetstatus: testing -> resolved
nosy: mpm, vadim, tonfa
messages: + msg140
2005-10-26 23:19:20mpmsetassignedto: mpm -> vadim
nosy: mpm, vadim, tonfa
2005-10-24 22:23:17mpmsetstatus: chatting -> testing
nosy: mpm, vadim, tonfa
messages: + msg39
2005-10-23 01:04:56mpmsetnosy: mpm, vadim, tonfa
messages: + msg27
2005-10-22 19:40:32tonfasetfiles: + ext_traceback.diff
nosy: + tonfa
messages: + msg26
2005-10-21 16:39:13mpmsetnosy: + mpm
messages: + msg19
assignedto: mpm
2005-10-21 04:52:38vadimsetstatus: unread -> chatting
messages: + msg13
2005-10-21 04:47:12vadimcreate