[Pkg-bazaar-commits] ./bzr/unstable r397: - open_tracefile takes a tracefilename parameter

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


------------------------------------------------------------
revno: 397
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Mon 2005-05-09 10:00:23 +1000
message:
  - open_tracefile takes a tracefilename parameter
modified:
  NEWS
  bzrlib/trace.py
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2005-05-06 02:49:04 +0000
+++ b/NEWS	2005-05-09 00:00:23 +0000
@@ -48,6 +48,8 @@
 
     * Simpler and faster compare_inventories() function.
 
+    * bzrlib.open_tracefile() takes a tracefilename parameter.
+
 bzr-0.0.4  2005-04-22
 
   ENHANCEMENTS:

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2005-05-05 06:21:22 +0000
+++ b/bzrlib/trace.py	2005-05-09 00:00:23 +0000
@@ -24,7 +24,6 @@
 
 
 import sys, os
-import bzrlib
 
 ######################################################################
 # messages and logging
@@ -94,7 +93,7 @@
 
 
 
-def open_tracefile(argv):
+def open_tracefile(argv=[], tracefilename='~/.bzr.log'):
     # 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.
@@ -103,7 +102,7 @@
 
     _starttime = os.times()[4]
 
-    trace_fname = os.path.join(os.path.expanduser('~/.bzr.log'))
+    trace_fname = os.path.join(os.path.expanduser(tracefilename))
     _rollover_trace_maybe(trace_fname)
 
     # buffering=1 means line buffered
@@ -115,9 +114,7 @@
         t.write("you can delete or truncate this file, or include sections in\n")
         t.write("bug reports to bazaar-ng at lists.canonical.com\n\n")
 
-    # TODO: If we failed to create the file, perhaps give a warning
-    # but don't abort; send things to /dev/null instead?
-
+    import bzrlib
     _write_trace('bzr %s invoked on python %s (%s)'
                  % (bzrlib.__version__,
                     '.'.join(map(str, sys.version_info)),



More information about the Pkg-bazaar-commits mailing list