Rev 4712: (mbp) deprecate trace.info, error, show_error in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Sep 23 07:54:17 BST 2009


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

------------------------------------------------------------
revno: 4712 [merge]
revision-id: pqm at pqm.ubuntu.com-20090923065414-vue8c7speunw9wbq
parent: pqm at pqm.ubuntu.com-20090922150120-8per9svh0qr8ywua
parent: mbp at sourcefrog.net-20090923060145-74wgpgv0knm8x6xm
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Wed 2009-09-23 07:54:14 +0100
message:
  (mbp) deprecate trace.info, error, show_error
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/check.py                check.py-20050309040759-f3a679400c06bcc1
  bzrlib/commands.py             bzr.py-20050309040720-d10f4714595cf8c3
  bzrlib/foreign.py              foreign.py-20081112170002-olsxmandkk8qyfuq-1
  bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
  bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
  bzrlib/transport/ftp/_gssapi.py _gssapi.py-20080611190840-7ejrtp884bk5eu72-2
=== modified file 'NEWS'
--- a/NEWS	2009-09-19 01:33:10 +0000
+++ b/NEWS	2009-09-23 06:54:14 +0000
@@ -130,6 +130,9 @@
 * ``bzrlib.tests`` now uses ``stopTestRun`` for its ``TestResult``
   subclasses - the same as python's unittest module. (Robert Collins)
 
+* ``bzrlib.trace.log_error``, ``error`` and ``info`` have been deprecated.
+  (Martin Pool)
+
 Internals
 *********
 

=== modified file 'bzrlib/check.py'
--- a/bzrlib/check.py	2009-08-05 02:30:59 +0000
+++ b/bzrlib/check.py	2009-09-18 01:06:10 +0000
@@ -55,7 +55,7 @@
 from bzrlib.repository import Repository
 from bzrlib.revision import NULL_REVISION
 from bzrlib.symbol_versioning import deprecated_function, deprecated_in
-from bzrlib.trace import log_error, note
+from bzrlib.trace import note
 import bzrlib.ui
 from bzrlib.workingtree import WorkingTree
 
@@ -201,7 +201,7 @@
                 len(self.unreferenced_versions))
         if verbose and len(self.unreferenced_versions):
                 for file_id, revision_id in self.unreferenced_versions:
-                    log_error('unreferenced version: {%s} in %s', revision_id,
+                    note('unreferenced version: {%s} in %s', revision_id,
                         file_id)
         if self.missing_inventory_sha_cnt:
             note('%6d revisions are missing inventory_sha1',
@@ -445,9 +445,9 @@
                     if do_branch:
                         scan_branch(branch, needed_refs, to_unlock)
             if do_branch and not branches:
-                log_error("No branch found at specified location.")
+                note("No branch found at specified location.")
             if do_tree and base_tree is None and not saw_tree:
-                log_error("No working tree found at specified location.")
+                note("No working tree found at specified location.")
             if do_repo or do_branch or do_tree:
                 if do_repo:
                     note("Checking repository at '%s'."
@@ -457,11 +457,11 @@
                 result.report_results(verbose)
         else:
             if do_tree:
-                log_error("No working tree found at specified location.")
+                note("No working tree found at specified location.")
             if do_branch:
-                log_error("No branch found at specified location.")
+                note("No branch found at specified location.")
             if do_repo:
-                log_error("No repository found at specified location.")
+                note("No repository found at specified location.")
     finally:
         for thing in to_unlock:
             thing.unlock()

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2009-09-15 02:57:23 +0000
+++ b/bzrlib/commands.py	2009-09-17 07:16:12 +0000
@@ -101,11 +101,11 @@
             registry.Registry.register(self, k_unsquished, cmd,
                                        override_existing=decorate, info=info)
         except KeyError:
-            trace.log_error('Two plugins defined the same command: %r' % k)
-            trace.log_error('Not loading the one in %r' %
-                            sys.modules[cmd.__module__])
-            trace.log_error('Previously this command was registered from %r' %
-                            sys.modules[previous.__module__])
+            trace.warning('Two plugins defined the same command: %r' % k)
+            trace.warning('Not loading the one in %r' %
+                sys.modules[cmd.__module__])
+            trace.warning('Previously this command was registered from %r' %
+                sys.modules[previous.__module__])
         return previous
 
     def register_lazy(self, command_name, aliases, module_name):

=== modified file 'bzrlib/foreign.py'
--- a/bzrlib/foreign.py	2009-07-14 02:15:03 +0000
+++ b/bzrlib/foreign.py	2009-09-18 01:25:08 +0000
@@ -284,7 +284,6 @@
         from bzrlib import urlutils
         from bzrlib.bzrdir import BzrDir
         from bzrlib.errors import BzrCommandError, NoWorkingTree
-        from bzrlib.trace import info
         from bzrlib.workingtree import WorkingTree
 
         if directory is None:

=== modified file 'bzrlib/smart/server.py'
--- a/bzrlib/smart/server.py	2009-09-18 05:45:06 +0000
+++ b/bzrlib/smart/server.py	2009-09-23 06:54:14 +0000
@@ -143,8 +143,7 @@
                 # dont log when CTRL-C'd.
                 raise
             except Exception, e:
-                trace.error("Unhandled smart server error.")
-                trace.log_exception_quietly()
+                trace.report_exception(sys.exc_info(), sys.stderr)
                 raise
         finally:
             self._stopped.set()

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2009-09-03 02:59:56 +0000
+++ b/bzrlib/trace.py	2009-09-23 06:01:45 +0000
@@ -59,7 +59,6 @@
 import logging
 import os
 import sys
-import re
 import time
 
 from bzrlib.lazy_import import lazy_import
@@ -72,6 +71,11 @@
 
 import bzrlib
 
+from bzrlib.symbol_versioning import (
+    deprecated_function,
+    deprecated_in,
+    )
+
 lazy_import(globals(), """
 from bzrlib import (
     debug,
@@ -123,16 +127,35 @@
     _bzr_logger.warning(*args, **kwargs)
 
 
-# configure convenient aliases for output routines
-#
-# TODO: deprecate them, have one name for each.
-info = note
-log_error = _bzr_logger.error
-error =     _bzr_logger.error
+ at deprecated_function(deprecated_in((2, 1, 0)))
+def info(*args, **kwargs):
+    """Deprecated: use trace.note instead."""
+    note(*args, **kwargs)
+
+
+ at deprecated_function(deprecated_in((2, 1, 0)))
+def log_error(*args, **kwargs):
+    """Deprecated: use bzrlib.trace.show_error instead"""
+    _bzr_logger.error(*args, **kwargs)
+
+
+ at deprecated_function(deprecated_in((2, 1, 0)))
+def error(*args, **kwargs):
+    """Deprecated: use bzrlib.trace.show_error instead"""
+    _bzr_logger.error(*args, **kwargs)
+
+
+def show_error(msg):
+    """Show an error message to the user.
+
+    Don't use this for exceptions, use report_exception instead.
+    """
+    _bzr_logger.error(*args, **kwargs)
 
 
 _last_mutter_flush_time = None
 
+
 def mutter(fmt, *args):
     global _last_mutter_flush_time
     if _trace_file is None:

=== modified file 'bzrlib/transport/ftp/_gssapi.py'
--- a/bzrlib/transport/ftp/_gssapi.py	2009-04-27 16:10:10 +0000
+++ b/bzrlib/transport/ftp/_gssapi.py	2009-09-18 01:25:08 +0000
@@ -25,7 +25,7 @@
     config,
     errors,
     )
-from bzrlib.trace import info, mutter
+from bzrlib.trace import mutter
 from bzrlib.transport.ftp import FtpTransport
 from bzrlib.transport import register_transport_proto, register_transport
 
@@ -81,7 +81,7 @@
                         if not ((resp.startswith('235 ') and rc == 1) or
                                 (resp.startswith('335 ') and rc == 0)):
                             raise ftplib.error_reply, resp
-            info("Authenticated as %s" % kerberos.authGSSClientUserName(
+            trace.note("Authenticated as %s" % kerberos.authGSSClientUserName(
                     self.vc))
 
             # Monkey patch ftplib




More information about the bazaar-commits mailing list