small patch for sftp urls

Erik Bågfors zindar at gmail.com
Fri Nov 11 13:44:44 GMT 2005


Hi.  Here is a very small patch for sftp urls.

The problem is that is always wants you to have user in the path, as
in sftp://user@host/path but if you do "bzr push sftp://host/path" it
automatically adds the "user@" part for you.

What happens than is the following


bzr: ERROR: path u'sftp://foo/path' is not under base URL
u'sftp://bagfors@foo/path'

the following patch makes it so it just compares the "path" part of
the url (ignoring user, and host)


=== modified file 'bzrlib/transport/sftp.py'
--- bzrlib/transport/sftp.py
+++ bzrlib/transport/sftp.py
@@ -154,7 +154,9 @@

     def relpath(self, abspath):
         # FIXME: this is identical to HttpTransport -- share it
-        if not abspath.startswith(self.base):
+        m = self._url_matcher.match(abspath)
+        path = m.group(5)
+        if not path.startswith(self._path):
             raise NonRelativePath('path %r is not under base URL %r'
                            % (abspath, self.base))
         pl = len(self.base)




More information about the bazaar mailing list