[Pkg-bazaar-commits] ./bzr/unstable r344: - It's not an error to use the library without

Martin Pool mbp at sourcefrog.net
Fri Apr 10 07:51:54 UTC 2009


------------------------------------------------------------
revno: 344
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Thu 2005-05-05 12:29:38 +1000
message:
  - It's not an error to use the library without
    opening the trace file
modified:
  NEWS
  bzrlib/__init__.py
  bzrlib/commands.py
  bzrlib/trace.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2005-05-03 12:37:47 +0000
+++ b/NEWS	2005-05-05 02:29:38 +0000
@@ -25,6 +25,9 @@
 
     * Better help messages for many commands.
 
+    * Expose bzrlib.open_tracefile() to start the tracefile; until
+      this is called trace messages are just discarded.
+
 
 bzr-0.0.4  2005-04-22
 

=== modified file 'bzrlib/__init__.py'
--- a/bzrlib/__init__.py	2005-04-26 10:37:53 +0000
+++ b/bzrlib/__init__.py	2005-05-05 02:29:38 +0000
@@ -21,7 +21,7 @@
 from osutils import format_date
 from tree import Tree
 from diff import diff_trees
-from trace import mutter, warning
+from trace import mutter, warning, open_tracefile
 import add
 
 BZRDIR = ".bzr"

=== modified file 'bzrlib/commands.py'
--- a/bzrlib/commands.py	2005-05-03 08:17:43 +0000
+++ b/bzrlib/commands.py	2005-05-05 02:29:38 +0000
@@ -996,7 +996,7 @@
 def main(argv):
     import errno
     
-    bzrlib.trace.create_tracefile(argv)
+    bzrlib.open_tracefile(argv)
 
     try:
         try:

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2005-05-03 08:00:27 +0000
+++ b/bzrlib/trace.py	2005-05-05 02:29:38 +0000
@@ -1,6 +1,3 @@
-#! /usr/bin/env python
-# -*- coding: UTF-8 -*-
-
 # 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
 # the Free Software Foundation; either version 2 of the License, or
@@ -20,6 +17,12 @@
 __author__ = "Martin Pool <mbp at canonical.com>"
 
 
+"""Messages and logging for bazaar-ng
+
+Nothing is actually logged unless you call bzrlib.open_tracefile().
+"""
+
+
 import sys, os, time, socket, stat, codecs
 import bzrlib
 
@@ -43,7 +46,8 @@
 
 
 def _write_trace(msg):
-    _tracefile.write(_logprefix + msg + '\n')
+    if _tracefile:
+        _tracefile.write(_logprefix + msg + '\n')
 
 
 def warning(msg):
@@ -89,7 +93,7 @@
 
 
 
-def create_tracefile(argv):
+def open_tracefile(argv):
     # Messages are always written to here, so that we have some
     # information if something goes wrong.  In a future version this
     # file will be removed on successful completion.



More information about the Pkg-bazaar-commits mailing list