Rev 2843: Report locale, encodings and plugins in traceback in http://sourcefrog.net/bzr/trivial

Martin Pool mbp at sourcefrog.net
Fri Sep 21 04:07:12 BST 2007


At http://sourcefrog.net/bzr/trivial

------------------------------------------------------------
revno: 2843
revision-id: 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:
  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
=== modified file 'NEWS'
--- a/NEWS	2007-09-21 02:20:23 +0000
+++ b/NEWS	2007-09-21 03:07:10 +0000
@@ -48,6 +48,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 03:07:10 +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 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
@@ -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,16 @@
                         '.'.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: %r\n" % (
+            sorted(plugin.plugins().keys())))
+    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