[BUG] transport/memory.py doesn't handle strings

Robert Collins robertc at robertcollins.net
Sun Oct 23 03:24:01 BST 2005


On Wed, 2005-10-19 at 01:49 -0400, Aaron Bentley wrote:

> Yeah, but
> for f in 'hello':
>     outf.write(f)
> 
> has the same results as
> 
> for f in ['hel', 'lo']:
>     outf.write(f)
> 
> has the same results as
> 
> for f in StringIO('hello'):
>     outf.write(f)

Not if its too a file system with non trivial overhead per write.

And if the layer doing the write wants to optimise, then with a file
object it is just:
for data in source.read(buffer_limit):
    outf.write(data)

If you have something that has fairly random behaviour, you have to
manually manage the data to create good sized blocks.

> In all cases, when you're done looping, you've written 'hello' to outf.
>  The number of steps it takes isn't hugely relevant.

Well, see above.

> It looked fine last I checked.  It was iterating up to the root, and
> stopping there.  If you substituted transport('a') for transport('..')
> in that loop, I'd expect it to be infinite.

I think we should modify transport so that
'LocalTransport('/').clone('..') raises an exception.

Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20051023/15ecf0ba/attachment.pgp 


More information about the bazaar mailing list