~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/osutils.py

  • Committer: Robert Collins
  • Date: 2008-07-30 09:50:22 UTC
  • mto: This revision was merged to the branch mainline in revision 3596.
  • Revision ID: robertc@robertcollins.net-20080730095022-4tc7ij34c0tmejb5
 * Deleting directories by hand before running ``bzr rm`` will not
   cause subsequent errors in ``bzr st`` and ``bzr commit``.
   (Robert Collins, #150438)

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