[MERGE] Make ftp:// a little more resilient for initial push

John Arbash Meinel john at arbash-meinel.com
Mon Jun 4 23:13:23 BST 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Right now we have to handle lots of error strings to make sure we understand
why pushing a file is failing. However, we can bias our guesswork so that even
if we don't understand the error string, we have a better chance of getting it
right. There are a couple patches I would like to propose for ftp:

=== modified file 'bzrlib/transport/ftp.py'
- --- bzrlib/transport/ftp.py     2007-04-18 14:06:46 +0000
+++ bzrlib/transport/ftp.py     2007-06-04 22:06:11 +0000
@@ -329,7 +329,8 @@
                     raise e
                 raise
         except ftplib.error_perm, e:
- -            self._translate_perm_error(e, abspath, extra='could not store')
+            self._translate_perm_error(e, abspath, extra='could not store',
+                                       unknown_exc=errors.NoSuchFile)
         except ftplib.error_temp, e:
             if retries > _number_of_retries:
                 raise errors.TransportError("FTP temporary error during PUT
%s. Aborting."


and

=== modified file 'bzrlib/transport/ftp.py'
- --- bzrlib/transport/ftp.py     2007-04-18 14:06:46 +0000
+++ bzrlib/transport/ftp.py     2007-06-04 22:07:41 +0000
@@ -166,6 +166,7 @@
             or 'could not open' in s
             or 'no such dir' in s
             or 'could not create file' in s # vsftpd
+            or "file doesn't exist" in s
             ):
             raise errors.NoSuchFile(path, extra=extra)
         if ('file exists' in s):



The former biases "put_file()" to assume it is failing because the parent dir
doesn't exist, and the latter adds a specific string that we have seen.

Thoughts?

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGZI6DJdeBCYSNAAMRAlF7AJwJ1/RU7vbbVIWdTGiR7PPndBKWcQCcCbrK
7dgRYJt8UyorwqzxRznMrLk=
=Urtm
-----END PGP SIGNATURE-----



More information about the bazaar mailing list