~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Andrew Bennetts
  • Date: 2008-08-07 00:25:38 UTC
  • mfrom: (3612 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3613.
  • Revision ID: andrew.bennetts@canonical.com-20080807002538-mtl1fcgy2fdabha4
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1168
1168
 
1169
1169
        dirblock = []
1170
1170
        append = dirblock.append
1171
 
        for name in sorted(_listdir(top)):
1172
 
            abspath = top_slash + name
1173
 
            statvalue = _lstat(abspath)
1174
 
            kind = _kind_from_mode(statvalue.st_mode & 0170000, 'unknown')
1175
 
            append((relprefix + name, name, kind, statvalue, abspath))
 
1171
        try:
 
1172
            names = sorted(_listdir(top))
 
1173
        except OSError, e:
 
1174
            if getattr(e, 'errno', None) == errno.ENOTDIR:
 
1175
                # We have been asked to examine a file, this is fine.
 
1176
                pass
 
1177
            else:
 
1178
                raise
 
1179
        else:
 
1180
            for name in names:
 
1181
                abspath = top_slash + name
 
1182
                statvalue = _lstat(abspath)
 
1183
                kind = _kind_from_mode(statvalue.st_mode & 0170000, 'unknown')
 
1184
                append((relprefix + name, name, kind, statvalue, abspath))
1176
1185
        yield (relroot, top), dirblock
1177
1186
 
1178
1187
        # push the user specified dirs from dirblock