Rev 2567: Show bzr.log location in bzr --version output. in http://sourcefrog.net/bzr/trivial

Martin Pool mbp at sourcefrog.net
Mon Jul 2 05:48:57 BST 2007


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

------------------------------------------------------------
revno: 2567
revision-id: mbp at sourcefrog.net-20070702044841-bhqv1470tepruga0
parent: pqm at pqm.ubuntu.com-20070629150144-xoeghcfb52pit8tv
committer: Martin Pool <mbp at sourcefrog.net>
branch nick: trivial
timestamp: Mon 2007-07-02 14:48:41 +1000
message:
  Show bzr.log location in bzr --version output.
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
  bzrlib/trace.py                trace.py-20050309040759-c8ed824bdcd4748a
  bzrlib/version.py              version.py-20060816024207-ves6ult9a11taj9t-1
=== modified file 'NEWS'
--- a/NEWS	2007-06-28 19:11:00 +0000
+++ b/NEWS	2007-07-02 04:48:41 +0000
@@ -57,6 +57,9 @@
       library users and plugins. See the ``bzrlib.api`` module for details.
       (Robert Collins)
 
+    * ``bzrtracefilename --version`` now shows the location of the bzr log file, which
+      is especially useful on Windows.  (Martin Pool)
+
   INTERNALS:
 
     * New SMTPConnection class to unify email handling.  (Adeodato Simó)

=== modified file 'bzrlib/tests/blackbox/test_version.py'
--- a/bzrlib/tests/blackbox/test_version.py	2007-03-12 21:57:13 +0000
+++ b/bzrlib/tests/blackbox/test_version.py	2007-07-02 04:48:41 +0000
@@ -30,3 +30,4 @@
         self.assertEquals(1, out.count("Using python standard library:"))
         self.assertEquals(1, out.count("Using bzrlib:"))
         self.assertEquals(1, out.count("Using bazaar configuration:"))
+        self.assertContainsRe(out, r'(?m)^Logging to:.*bzr\.log')

=== modified file 'bzrlib/trace.py'
--- a/bzrlib/trace.py	2007-03-27 04:57:59 +0000
+++ b/bzrlib/trace.py	2007-07-02 04:48:41 +0000
@@ -75,6 +75,7 @@
 _trace_file = None
 _trace_depth = 0
 _bzr_log_file = None
+_bzr_log_filename = None
 
 
 # configure convenient aliases for output routines
@@ -141,7 +142,7 @@
     # 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.
-    global _file_handler, _bzr_log_file
+    global _file_handler, _bzr_log_file, _bzr_log_filename
     import codecs
 
     if tracefilename is None:
@@ -150,14 +151,14 @@
             home = win32utils.get_home_location()
         else:
             home = os.path.expanduser('~')
-        tracefilename = os.path.join(home, '.bzr.log')
+        _bzr_log_filename = os.path.join(home, '.bzr.log')
 
-    trace_fname = os.path.expanduser(tracefilename)
-    _rollover_trace_maybe(trace_fname)
+    _bzr_log_filename = os.path.expanduser(_bzr_log_filename)
+    _rollover_trace_maybe(_bzr_log_filename)
     try:
         LINE_BUFFERED = 1
         #tf = codecs.open(trace_fname, 'at', 'utf8', buffering=LINE_BUFFERED)
-        tf = open(trace_fname, 'at', LINE_BUFFERED)
+        tf = open(_bzr_log_filename, 'at', LINE_BUFFERED)
         _bzr_log_file = tf
         # tf.tell() on windows always return 0 until some writing done
         tf.write('\n')

=== modified file 'bzrlib/version.py'
--- a/bzrlib/version.py	2007-05-04 11:02:41 +0000
+++ b/bzrlib/version.py	2007-07-02 04:48:41 +0000
@@ -25,6 +25,7 @@
     config,
     errors,
     osutils,
+    trace,
     )
 from bzrlib.branch import Branch
 
@@ -50,6 +51,7 @@
     else:
         print bzrlib.__path__[0]
     print "Using bazaar configuration:", config.config_dir()
+    print "Logging to:", trace._bzr_log_filename
     print
     print bzrlib.__copyright__
     print "http://bazaar-vcs.org/"




More information about the bazaar-commits mailing list