~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: mbp at sourcefrog
  • Date: 2005-03-09 07:00:48 UTC
  • Revision ID: mbp@sourcefrog.net-20050309070048-a0f0a23015e90267
new --timezone option for bzr log

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18
18
 
19
19
import os, types, re, time, types
20
 
from stat import S_ISREG, S_ISDIR, S_ISLNK, ST_MODE, ST_SIZE
 
20
from stat import S_ISREG, S_ISDIR, ST_MODE, ST_SIZE
21
21
 
22
22
from errors import bailout
23
23
 
51
51
        return 'file'
52
52
    elif S_ISDIR(mode):
53
53
        return 'directory'
54
 
    elif S_ISLNK(mode):
55
 
        return 'symlink'
56
54
    else:
57
 
        bailout("can't handle file kind with mode %o of %r" % (mode, f)) 
 
55
        bailout("can't handle file kind of %r" % fp)
58
56
 
59
57
 
60
58
 
135
133
        import pwd
136
134
        uid = os.getuid()
137
135
        w = pwd.getpwuid(uid)
138
 
        gecos = w.pw_gecos
139
 
        comma = gecos.find(',')
140
 
        if comma == -1:
141
 
            realname = gecos
142
 
        else:
143
 
            realname = gecos[:comma]
 
136
        realname, junk = w.pw_gecos.split(',', 1)
144
137
        return '%s <%s@%s>' % (realname, w.pw_name, socket.getfqdn())
145
138
    except ImportError:
146
139
        pass
192
185
        tt = time.gmtime(t)
193
186
        offset = 0
194
187
    elif timezone == 'original':
195
 
        if offset == None:
196
 
            offset = 0
197
 
        tt = time.gmtime(t + offset)
 
188
        tt = time.gmtime(t - offset)
198
189
    elif timezone == 'local':
199
190
        tt = time.localtime(t)
200
191
        offset = local_time_offset()