[Pkg-bazaar-commits] ./bzr/unstable r359: - pychecker fixups

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:52:02 UTC 2009


------------------------------------------------------------
revno: 359
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Thu 2005-05-05 16:14:53 +1000
message:
  - pychecker fixups
modified:
  bzrlib/commands.py
  bzrlib/trace.py
-------------- next part --------------
=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-05-05 03:34:34 +0000
+++ b/bzrlib/commands.py	2005-05-05 06:14:53 +0000
@@ -869,10 +869,10 @@
         cmdobj = cmd_class(cmdopts, cmdargs).status 
 
 
-def _report_exception(e, summary, quiet=False):
+def _report_exception(summary, quiet=False):
     import traceback
     log_error('bzr: ' + summary)
-    bzrlib.trace.log_exception(e)
+    bzrlib.trace.log_exception()
 
     if not quiet:
         tb = sys.exc_info()[2]
@@ -897,7 +897,7 @@
                 sys.stdout.flush()
         except BzrError, e:
             quiet = isinstance(e, (BzrCommandError))
-            _report_exception(e, 'error: ' + e.args[0], quiet=quiet)
+            _report_exception('error: ' + e.args[0], quiet=quiet)
             if len(e.args) > 1:
                 for h in e.args[1]:
                     # some explanation or hints
@@ -907,10 +907,10 @@
             msg = 'assertion failed'
             if str(e):
                 msg += ': ' + str(e)
-            _report_exception(e, msg)
+            _report_exception(msg)
             return 2
         except KeyboardInterrupt, e:
-            _report_exception(e, 'interrupted', quiet=True)
+            _report_exception('interrupted', quiet=True)
             return 2
         except Exception, e:
             quiet = False
@@ -919,7 +919,7 @@
                 msg = 'broken pipe'
             else:
                 msg = str(e).rstrip('\n')
-            _report_exception(e, msg, quiet)
+            _report_exception(msg, quiet)
             return 2
     finally:
         bzrlib.trace.close_trace()

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2005-05-05 02:29:38 +0000
+++ b/bzrlib/trace.py	2005-05-05 06:14:53 +0000
@@ -23,7 +23,7 @@
 """
 
 
-import sys, os, time, socket, stat, codecs
+import sys, os
 import bzrlib
 
 ######################################################################
@@ -71,6 +71,7 @@
 
 
 def _rollover_trace_maybe(trace_fname):
+    import stat
     try:
         size = os.stat(trace_fname)[stat.ST_SIZE]
         if size <= 4 << 20:
@@ -98,6 +99,7 @@
     # information if something goes wrong.  In a future version this
     # file will be removed on successful completion.
     global _starttime, _tracefile
+    import stat, codecs
 
     _starttime = os.times()[4]
 
@@ -132,7 +134,8 @@
 
 
 
-def log_exception(e):
+def log_exception():
+    """Log the last exception into the trace file."""
     import traceback, cStringIO
     s = cStringIO.StringIO()
     traceback.print_exc(None, s)



More information about the Pkg-bazaar-commits mailing list