/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-05-11 16:35:34 UTC
  • mfrom: (5848.2.2 2.4-uses-py26)
  • Revision ID: pqm@pqm.ubuntu.com-20110511163534-yz28ddqwa5cicukr
(jameinel) Finally break compatibility with python 2.4/5. bzr-2.4.0 will be
 officially only compatible with python2.6/7 (John A Meinel)

Show diffs side-by-side

added added

removed removed

Lines of Context:
281
281
                    buffered = buffered[buffered_offset:]
282
282
                    buffered_data = [buffered]
283
283
                    buffered_len = len(buffered)
 
284
        # now that the data stream is done, close the handle
 
285
        fp.close()
284
286
        if buffered_len:
285
287
            buffered = ''.join(buffered_data)
286
288
            del buffered_data[:]
389
391
                                         self._host, self._port)
390
392
        return connection, (user, password)
391
393
 
 
394
    def disconnect(self):
 
395
        connection = self._get_connection()
 
396
        if connection is not None:
 
397
            connection.close()
 
398
 
392
399
    def _get_sftp(self):
393
400
        """Ensures that a connection is established"""
394
401
        connection = self._get_connection()
416
423
        :param relpath: The relative path to the file
417
424
        """
418
425
        try:
419
 
            # FIXME: by returning the file directly, we don't pass this
420
 
            # through to report_activity.  We could try wrapping the object
421
 
            # before it's returned.  For readv and get_bytes it's handled in
422
 
            # the higher-level function.
423
 
            # -- mbp 20090126
424
426
            path = self._remote_path(relpath)
425
427
            f = self._get_sftp().file(path, mode='rb')
426
428
            if self._do_prefetch and (getattr(f, 'prefetch', None) is not None):
715
717
            if (e.args[0].startswith('Directory not empty: ')
716
718
                or getattr(e, 'errno', None) == errno.ENOTEMPTY):
717
719
                raise errors.DirectoryNotEmpty(path, str(e))
 
720
            if e.args == ('Operation unsupported',):
 
721
                raise errors.TransportNotPossible()
718
722
            mutter('Raising exception with args %s', e.args)
719
723
        if getattr(e, 'errno', None) is not None:
720
724
            mutter('Raising exception with errno %s', e.errno)