/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: Neil Santos
  • Date: 2010-03-04 02:43:41 UTC
  • mto: (5080.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 5081.
  • Revision ID: neil_santos@users.sourceforge.net-20100304024341-ra7njxj4lzjb46rl
Removed separate lstat() and reverted LocalTransport and SFTPTransport's stat() methods to using lstat() internally.
Reworked how SFTPTransport's symlink() handles success and signals failure.
Removed lstat() declaration on the Transport base class.

Show diffs side-by-side

added added

removed removed

Lines of Context:
806
806
        except (IOError, paramiko.SSHException), e:
807
807
            self._translate_io_exception(e, path, ': failed to rmdir')
808
808
 
809
 
    def lstat(self, relpath):
810
 
        """Return the stat information for a file, without following symbolic links."""
811
 
        path = self._remote_path(relpath)
812
 
        try:
813
 
            return self._get_sftp().lstat(path)
814
 
        except (IOError, paramiko.SSHException), e:
815
 
            self._translate_io_exception(e, path, ': unable to lstat')
816
 
 
817
809
    def stat(self, relpath):
818
810
        """Return the stat information for a file."""
819
811
        path = self._remote_path(relpath)
820
812
        try:
821
 
            return self._get_sftp().stat(path)
 
813
            return self._get_sftp().lstat(path)
822
814
        except (IOError, paramiko.SSHException), e:
823
815
            self._translate_io_exception(e, path, ': unable to stat')
824
816
 
834
826
        """See Transport.symlink."""
835
827
        try:
836
828
            conn = self._get_sftp()
837
 
            retval = conn.symlink(source, link_name)
838
 
            return (SFTP_OK == retval)
 
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
                )
839
835
        except (IOError, paramiko.SSHException), e:
840
836
            self._translate_io_exception(e, link_name,
841
837
                                         ': unable to create symlink to %r' % (source))