[PATCH 4 of 4 STABLE V3] dispatch: drop the traceback module import in favor of using ui.traceback()

Matt Harbison matt_harbison at yahoo.com
Thu Feb 14 22:18:54 CST 2013


On Thu, 14 Feb 2013 22:57:54 -0500, Matt Harbison wrote:

> # HG changeset patch # User Matt Harbison <matt_harbison at yahoo.com>
> # Date 1360439790 18000 # Branch stable # Node ID
> 6e1745620172f71a9ec702939227d509b13c756e # Parent 
> 531876e328ce07dd3a93ea00e63b00afdfd0b806 dispatch: drop the traceback
> module import in favor of using ui.traceback()
> 
> This ensures chained exception tracebacks are printed when using the
> --debugger option.
> 

For some reason, I got really strange output when I tried to write a test
for this (almost looks like stdout and stderr output is interwoven).
Worse, if the changes were accepted and the test run again, the entire
test would fail and exit with code 258.  Is this a known problem with
using --debugger in the test suite (which probably isn't useful anyway), a
silly configuration issue on my end, or something else?

Below is a patch that can be applied on top of #4 to see the issue.  A
rerun will cause the test to fail with:

+  c:\temp\tmp6yk028hg-tst: line 447: syntax error near unexpected token `87'
+  c:\temp\tmp6yk028hg-tst: line 447: `c:\users\matt\projects\hg\mercurial\dispatch.py(87)_runcatch()'

One of the odd things is dispatch.py line 87 corresponds to a line with
nothing but 'try:'.  I ran it with:

    python run-tests.py --local -i test-subrepo.t -t 600


diff --git a/tests/test-subrepo.t b/tests/test-subrepo.t
--- a/tests/test-subrepo.t
+++ b/tests/test-subrepo.t
@@ -650,8 +650,47 @@
 
 Ensure a full traceback, not just the SubrepoAbort part
 
-  $ hg -R issue1852b update --traceback 2>&1 | grep 'raise util\.Abort'
-      raise util.Abort(_("default path for subrepository not found"))
+  $ hg -R issue1852b update --debugger
+  entering debugger - type c to continue starting hg or h for help
+  > c:\users\matt\projects\hg\mercurial\dispatch.py(87)_runcatch()
+  -> try:
+  (Pdb) 
+  > c:\python27_x86\lib\bdb.py(67)dispatch_line()
+  -> if self.quitting: raise BdbQuit
+  (Pdb) 
+  Traceback (most recent call last):
+    File "c:\Users\Matt\Projects\hg\mercurial\dispatch.py", line 87, in _runcatch
+      try:
+    File "c:\Users\Matt\Projects\hg\mercurial\dispatch.py", line 87, in _runcatch
+      try:
+    File "c:\Python27_x86\lib\bdb.py", line 48, in trace_dispatch
+      return self.dispatch_line(frame)
+    File "c:\Python27_x86\lib\bdb.py", line 67, in dispatch_line
+      if self.quitting: raise BdbQuit
+  BdbQuit
+  ** unknown exception encountered, please report by visiting
+  ** http://mercurial.selenic.com/wiki/BugTracker
+  ** Python 2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]
+  ** Mercurial Distributed SCM (version 2.5.1+6-2ca4aad59a18+20130215)
+  ** Extensions loaded: 
+  Traceback (most recent call last):
+    File "c:/Users/Matt/Projects/hg/hg", line 38, in <module>
+      mercurial.dispatch.run()
+    File "c:\Users\Matt\Projects\hg\mercurial\dispatch.py", line 28, in run
+      sys.exit((dispatch(request(sys.argv[1:])) or 0) & 255)
+    File "c:\Users\Matt\Projects\hg\mercurial\dispatch.py", line 65, in dispatch
+      return _runcatch(req)
+    File "c:\Users\Matt\Projects\hg\mercurial\dispatch.py", line 87, in _runcatch
+      try:
+    File "c:\Users\Matt\Projects\hg\mercurial\dispatch.py", line 87, in _runcatch
+      try:
+    File "c:\Python27_x86\lib\bdb.py", line 48, in trace_dispatch
+      return self.dispatch_line(frame)
+    File "c:\Python27_x86\lib\bdb.py", line 67, in dispatch_line
+      if self.quitting: raise BdbQuit
+  bdb.BdbQuit
+  [1]
+# 2>&1 | grep 'raise util\.Abort'
 
 Pull -u now doesn't help
 





More information about the Mercurial-devel mailing list