~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/trace.py

  • Committer: mbp at sourcefrog
  • Date: 2005-04-04 13:10:26 UTC
  • Revision ID: mbp@sourcefrog.net-20050404131026-628553cc03687658
new 'renames' command

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
__author__ = "Martin Pool <mbp@canonical.com>"
21
21
 
22
22
 
23
 
import sys, os, time, socket, stat, codecs
 
23
import sys, os, time, socket, stat
24
24
import bzrlib
25
25
 
26
26
######################################################################
33
33
_tracefile = None
34
34
 
35
35
# used to have % (os.environ['USER'], time.time(), os.getpid()), 'w')
36
 
_starttime = None
 
36
 
37
37
 
38
38
# If false, notes also go to stdout; should replace this with --silent
39
39
# at some point.
85
85
 
86
86
    _starttime = os.times()[4]
87
87
 
88
 
    # XXX: Is HOME always set on Windows?
89
 
    trace_fname = os.path.join(os.environ['HOME'], '.bzr.log')
90
 
    _tracefile = codecs.open(trace_fname, 'at', 'utf8')
 
88
    _tracefile = file('.bzr.log', 'at')
91
89
    t = _tracefile
92
90
 
93
91
    if os.fstat(t.fileno())[stat.ST_SIZE] == 0:
104
102
    t.write('  version: %s\n' % bzrlib.__version__)
105
103
    t.write('  by %s on %s\n' % (bzrlib.osutils.username(), socket.getfqdn()))
106
104
    t.write('  arguments: %r\n' % argv)
107
 
    t.write('  working dir: %s\n' % os.getcwdu())
108
105
 
 
106
    # This causes a vfork; I don't care enough about it.
109
107
    t.write('  platform: %s\n' % sys.platform)
110
108
    t.write('  python: %s\n' % (sys.version_info,))
111
109