Rev 2845: show locale, encodings, plugins in error tracebacks (mbp) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Sep 21 07:49:54 BST 2007


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 2845
revision-id: pqm at pqm.ubuntu.com-20070921064952-v0xvjk4fo14c0p7a
parent: pqm at pqm.ubuntu.com-20070921051316-85muv96iv0duh31j
parent: mbp at sourcefrog.net-20070921061309-6uwzovw08llb2zdz
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-09-21 07:49:52 +0100
message:
  show locale, encodings, plugins in error tracebacks (mbp)
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/blackbox/test_exceptions.py test_exceptions.py-20060604211237-yi2cxg0ose3xk4id-1
  bzrlib/tests/test_trace.py     testtrace.py-20051110225523-a21117fc7a07eeff
  bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
    ------------------------------------------------------------
    revno: 2842.1.2
    merged: mbp at sourcefrog.net-20070921061309-6uwzovw08llb2zdz
    parent: mbp at sourcefrog.net-20070921030710-koafxqdakilf56t8
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: trivial
    timestamp: Fri 2007-09-21 16:13:09 +1000
    message:
      Also include plugin path and version in traceback
    ------------------------------------------------------------
    revno: 2842.1.1
    merged: mbp at sourcefrog.net-20070921030710-koafxqdakilf56t8
    parent: pqm at pqm.ubuntu.com-20070921022023-cgeid5vrxco9o4jo
    committer: Martin Pool <mbp at sourcefrog.net>
    branch nick: trivial
    timestamp: Fri 2007-09-21 13:07:10 +1000
    message:
      Report locale, encodings and plugins in traceback
=== modified file 'NEWS'
--- a/NEWS	2007-09-21 04:22:53 +0000
+++ b/NEWS	2007-09-21 06:49:52 +0000
@@ -51,6 +51,9 @@
    * Mutt is now a supported mail client; set ``mail_client=mutt`` in your
      bazaar.conf and ``send`` will use mutt. (Keir Mierle)
 
+   * Show encodings, locale and list of plugins in the traceback message.
+     (Martin Pool, #63894)
+
   BUG FIXES:
 
    * The basename, not the full path, is now used when checking whether

=== modified file 'bzrlib/tests/blackbox/test_exceptions.py'
--- a/bzrlib/tests/blackbox/test_exceptions.py	2007-06-26 20:32:49 +0000
+++ b/bzrlib/tests/blackbox/test_exceptions.py	2007-09-21 06:13:09 +0000
@@ -31,7 +31,11 @@
         out, err = self.run_bzr("assert-fail", retcode=3)
         self.assertContainsRe(err,
                 r'bzr: ERROR: exceptions\.AssertionError: always fails\n')
-        self.assertContainsRe(err, r'please send this report to')
+        self.assertContainsRe(err, r'Please send this report to')
+        self.assertContainsRe(err,
+            '(?m)^encoding: .*, fsenc: .*, lang: .*')
+        self.assertContainsRe(err,
+            '(?m)^plugins:$')
 
     # TODO: assert-fail doesn't need to always be present; we could just
     # register (and unregister) it from tests that want to touch it.

=== modified file 'bzrlib/tests/test_trace.py'
--- a/bzrlib/tests/test_trace.py	2007-08-31 02:00:37 +0000
+++ b/bzrlib/tests/test_trace.py	2007-09-21 03:07:10 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2007-08-31 02:00:37 +0000
+++ b/bzrlib/trace.py	2007-09-21 06:13:09 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2005, 2006 Canonical Ltd
+# Copyright (C) 2005, 2006, 2007 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -58,6 +58,7 @@
 lazy_import(globals(), """
 from cStringIO import StringIO
 import errno
+import locale
 import logging
 import traceback
 """)
@@ -65,7 +66,11 @@
 import bzrlib
 
 lazy_import(globals(), """
-from bzrlib import debug
+from bzrlib import (
+    debug,
+    osutils,
+    plugin,
+    )
 """)
 
 _file_handler = None
@@ -146,7 +151,6 @@
         if size <= 4 << 20:
             return
         old_fname = trace_fname + '.old'
-        from osutils import rename
         rename(trace_fname, old_fname)
     except OSError:
         return
@@ -352,5 +356,17 @@
                         '.'.join(map(str, sys.version_info)),
                         sys.platform)
     print >>err_file, 'arguments: %r' % sys.argv
-    print >>err_file
-    print >>err_file, "** please send this report to bazaar at lists.ubuntu.com"
+    err_file.write(
+        'encoding: %r, fsenc: %r, lang: %r\n' % (
+            osutils.get_user_encoding(), sys.getfilesystemencoding(),
+            os.environ.get('LANG')))
+    err_file.write("plugins:\n")
+    for name, a_plugin in sorted(plugin.plugins().items()):
+        err_file.write("  %-20s %s [%s]\n" %
+            (name, a_plugin.path(), a_plugin.__version__))
+    err_file.write(
+        "\n"
+        "** Please send this report to bazaar at lists.ubuntu.com\n"
+        "   with a description of what you were doing when the\n"
+        "   error occurred.\n"
+        )




More information about the bazaar-commits mailing list