mercurial/byterange.py
changeset 674 6513ba7d858a
parent 667 31a9aa890016
child 3673 eb0b4a2d70a9
equal deleted inserted replaced
673:8e518e11f6cf 674:6513ba7d858a
   359             # Try to retrieve as a file
   359             # Try to retrieve as a file
   360             try:
   360             try:
   361                 cmd = 'RETR ' + file
   361                 cmd = 'RETR ' + file
   362                 conn = self.ftp.ntransfercmd(cmd, rest)
   362                 conn = self.ftp.ntransfercmd(cmd, rest)
   363             except ftplib.error_perm, reason:
   363             except ftplib.error_perm, reason:
   364                 if str(reason)[:3] == '501':
   364                 if str(reason).startswith('501'):
   365                     # workaround for REST not supported error
   365                     # workaround for REST not supported error
   366                     fp, retrlen = self.retrfile(file, type)
   366                     fp, retrlen = self.retrfile(file, type)
   367                     fp = RangeableFileObject(fp, (rest,''))
   367                     fp = RangeableFileObject(fp, (rest,''))
   368                     return (fp, retrlen)
   368                     return (fp, retrlen)
   369                 elif str(reason)[:3] != '550':
   369                 elif not str(reason).startswith('550'):
   370                     raise IOError, ('ftp error', reason), sys.exc_info()[2]
   370                     raise IOError, ('ftp error', reason), sys.exc_info()[2]
   371         if not conn:
   371         if not conn:
   372             # Set transfer mode to ASCII!
   372             # Set transfer mode to ASCII!
   373             self.ftp.voidcmd('TYPE A')
   373             self.ftp.voidcmd('TYPE A')
   374             # Try a directory listing
   374             # Try a directory listing