[MERGE] Fix MemoryTransport().abspath('/foo')

John Arbash Meinel john at arbash-meinel.com
Fri Oct 13 08:47:06 BST 2006


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Bennetts wrote:
> MemoryTransport().abspath('/foo') was producing 'memory://foo/', which obviously
> isn't right.
> 
> The attached bundle fixes this by adjusting Transport._combine_paths.  No other
> transports seem to be affected though, so perhaps I've fixed this in the wrong
> place?
> 
> Anyway, here's the fix I have, it's simple and doesn't break any existing
> transport tests (and obviously passes the new ones).  Please review.
> 
> -Andrew.
> 
> 

v- Make sure you update to the latest bzr.dev. I got rid of these doc
string tests, in favor of real tests in the test suite. (I left them as
as examples, but not as doc tests).

It turns out DocTest doesn't play nice with lazy_import. So where they
conflict, I made lazy_import win.

>              '/home/sarah/project/foo'
>              >>> t._combine_paths('/home/sarah', '../../etc')
>              '/etc'
> +            >>> t._combine_paths('/home/sarah', '/etc')
> +            '/etc'
> +            >>> t._combine_paths('/home/sarah', '../../../etc')
> +            '/etc'
>  
>          :param base_path: urlencoded path for the transport root; typically a 
>               URL but need not contain scheme/host/etc.
> @@ -359,6 +363,8 @@
>              elif p != '':
>                  base_parts.append(p)
>          path = '/'.join(base_parts)
> +        if not path.startswith('/'):
> +            path = '/' + path
>          return path
>  
>      def relpath(self, abspath):
> 

Other than the one test, it looks good to me.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFL0R6JdeBCYSNAAMRAthgAJ96PoPzDjLgZsITBiwIj4Npgqd99wCggJZ8
7FEyCiVusCFMsxjqM5vJB5k=
=iGgJ
-----END PGP SIGNATURE-----




More information about the bazaar mailing list