~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/transport/sftp.py

  • Committer: Robert Collins
  • Date: 2010-04-08 04:34:03 UTC
  • mfrom: (5138 +trunk)
  • mto: This revision was merged to the branch mainline in revision 5139.
  • Revision ID: robertc@robertcollins.net-20100408043403-56z0d07vdqrx7f3t
Update bugfix for 528114 to trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
82
82
else:
83
83
    from paramiko.sftp import (SFTP_FLAG_WRITE, SFTP_FLAG_CREATE,
84
84
                               SFTP_FLAG_EXCL, SFTP_FLAG_TRUNC,
85
 
                               CMD_HANDLE, CMD_OPEN)
 
85
                               SFTP_OK, CMD_HANDLE, CMD_OPEN)
86
86
    from paramiko.sftp_attr import SFTPAttributes
87
87
    from paramiko.sftp_file import SFTPFile
88
88
 
810
810
        """Return the stat information for a file."""
811
811
        path = self._remote_path(relpath)
812
812
        try:
813
 
            return self._get_sftp().stat(path)
 
813
            return self._get_sftp().lstat(path)
814
814
        except (IOError, paramiko.SSHException), e:
815
815
            self._translate_io_exception(e, path, ': unable to stat')
816
816
 
 
817
    def readlink(self, relpath):
 
818
        """See Transport.readlink."""
 
819
        path = self._remote_path(relpath)
 
820
        try:
 
821
            return self._get_sftp().readlink(path)
 
822
        except (IOError, paramiko.SSHException), e:
 
823
            self._translate_io_exception(e, path, ': unable to readlink')
 
824
 
 
825
    def symlink(self, source, link_name):
 
826
        """See Transport.symlink."""
 
827
        try:
 
828
            conn = self._get_sftp()
 
829
            sftp_retval = conn.symlink(source, link_name)
 
830
            if SFTP_OK != sftp_retval:
 
831
                raise TransportError(
 
832
                    '%r: unable to create symlink to %r' % (link_name, source),
 
833
                    sftp_retval
 
834
                )
 
835
        except (IOError, paramiko.SSHException), e:
 
836
            self._translate_io_exception(e, link_name,
 
837
                                         ': unable to create symlink to %r' % (source))
 
838
 
817
839
    def lock_read(self, relpath):
818
840
        """
819
841
        Lock the given file for shared (read) access.