~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/ftp.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-13 03:42:59 UTC
  • mfrom: (1658.1.5 bzr.mbp.integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060413034259-6466a758a88b4a94
(mbp) ftp push fix; Working_tree.set_inventory; test suite warnings

Show diffs side-by-side

added added

removed removed

Lines of Context:
38
38
 
39
39
from bzrlib.transport import Transport
40
40
from bzrlib.errors import (TransportNotPossible, TransportError,
41
 
                           NoSuchFile, FileExists)
 
41
                           NoSuchFile, FileExists, DirectoryNotEmpty)
42
42
from bzrlib.trace import mutter, warning
43
43
 
44
44
 
289
289
        except ftplib.error_perm, e:
290
290
            raise TransportError(orig_error=e)
291
291
 
 
292
    def rmdir(self, rel_path):
 
293
        """Delete the directory at rel_path"""
 
294
        try:
 
295
            mutter("FTP rmd: %s" % self._abspath(rel_path))
 
296
 
 
297
            f = self._get_FTP()
 
298
            f.rmd(self._abspath(rel_path))
 
299
        except ftplib.error_perm, e:
 
300
            if str(e).endswith("Directory not empty"):
 
301
                raise DirectoryNotEmpty(self._abspath(rel_path), extra=str(e))
 
302
            else:
 
303
                raise TransportError(msg="Cannot remove directory at %s" % \
 
304
                        self._abspath(rel_path), extra=str(e))
 
305
 
292
306
    def append(self, relpath, f):
293
307
        """Append the text in the file-like object into the final
294
308
        location.
309
323
        except ftplib.error_perm, e:
310
324
            raise TransportError(orig_error=e)
311
325
 
 
326
    rename = move
 
327
 
312
328
    def delete(self, relpath):
313
329
        """Delete the item at relpath"""
314
330
        try:
316
332
            f = self._get_FTP()
317
333
            f.delete(self._abspath(relpath))
318
334
        except ftplib.error_perm, e:
319
 
            raise TransportError(orig_error=e)
 
335
            if str(e).endswith("No such file or directory"):
 
336
                raise NoSuchFile(self._abspath(relpath), extra=str(e))
 
337
            else:
 
338
                raise TransportError(orig_error=e)
320
339
 
321
340
    def listable(self):
322
341
        """See Transport.listable."""