patch: fix sftp paths

Robey Pointer robey at lag.net
Wed Nov 30 22:25:30 GMT 2005


On 30 Nov 2005, at 2:57, James Henstridge wrote:

> Robey Pointer wrote:
>
>> This patch fixes absolute SFTP paths to work again after James' patch
>> (removes 3 lines of old code that are no longer needed now that we're
>> properly un-parsing urls), and also fixes a unicode encoding issue in
>> the exclusive-open code.
>
> Weird.  This if/else branch does not exist at all in the branch I
> submitted, and is slotted between two lines added by my branch.  I  
> guess
> it was an incorrect conflict resolution.
>
> I think the if statement should go altogether.

Just for the record: I agree, the patch should remove the entire "if"  
statement.  Amended below.

robey



=== modified file 'bzrlib/transport/sftp.py'
--- bzrlib/transport/sftp.py
+++ bzrlib/transport/sftp.py
@@ -568,11 +568,6 @@
      def _sftp_connect(self):
          vendor = _get_ssh_vendor()
-        if (self._path is None) or (self._path == ''):
-            self._path = ''
-        else:
-            # remove leading '/'
-            self._path = urllib.unquote(self._path[1:])
          if vendor != 'none':
              sock = SFTPSubprocess(self._host, self._port,  
self._username)
              self._sftp = SFTPClient(sock)
@@ -692,7 +687,7 @@
          :param relpath: The relative path, where the file should be  
opened
          """
-        path = self._abspath(relpath)
+        path = self._sftp._adjust_cwd(self._abspath(relpath))
          attr = SFTPAttributes()
          mode = (SFTP_FLAG_WRITE | SFTP_FLAG_CREATE
                  | SFTP_FLAG_TRUNC | SFTP_FLAG_EXCL)





More information about the bazaar mailing list