~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: John Arbash Meinel
  • Date: 2005-09-18 16:09:41 UTC
  • mto: (1185.1.32)
  • mto: This revision was merged to the branch mainline in revision 1390.
  • Revision ID: john@arbash-meinel.com-20050918160940-ab133a1f31616576
Added test cases for handling bogus files.

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, errno, sys
20
 
from stat import S_ISREG, S_ISDIR, S_ISLNK, ST_MODE, ST_SIZE
 
20
from stat import (S_ISREG, S_ISDIR, S_ISLNK, ST_MODE, ST_SIZE,
 
21
        S_ISCHR, S_ISBLK, S_ISFIFO, S_ISSOCK)
21
22
 
22
23
from bzrlib.errors import BzrError
23
24
from bzrlib.trace import mutter
64
65
        return 'directory'
65
66
    elif S_ISLNK(mode):
66
67
        return 'symlink'
 
68
    elif S_ISCHR(mode):
 
69
        return 'chardev'
 
70
    elif S_ISBLK(mode):
 
71
        return 'block'
 
72
    elif S_ISFIFO(mode):
 
73
        return 'fifo'
 
74
    elif S_ISSOCK(mode):
 
75
        return 'socket'
67
76
    else:
68
 
        raise BzrError("can't handle file kind with mode %o of %r" % (mode, f))
 
77
        return 'unknown'
69
78
 
70
79
 
71
80
def kind_marker(kind):