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

John A Meinel john at arbash-meinel.com
Tue Oct 18 22:45:31 BST 2005


There are a couple of changes that should be made to the
transport/memory.py implementation.
First, most of the "put" functions can take either a file-like object, or
a string. Which means that MemoryTransport.put() shouldn't just call
read(), it should also check to see if it is already a string. (Either
that, or we can change the api if you really prefer).

Also, I would recommend including MemoryTransport into the test suite.

I already wrote a suite for all Transports which you just have to inherit
from. I see that there is a test suite, but all you really had to do was
inherit from the TestTransportMixin which makes sure to test the complete
API. (See how TestLocalTransport and TestHttpTransport are implemented).

I'm also concerned that MemoryTransport.clone() returns the exact copy of
itself. Because one of the fundamental bits of Transport objects is that
they have a "base" where all paths are given relative to that base.

Since all files and directories are stored inside the dictionary as
relative paths, clone(offset=".bzr/") will fail. And this type of cloning
is used in bzrlib/branch.py so that the Store objects have "base" set
appropriately.

clone() is also used in find_branch() since it returns a clone of the
parent directory when it is searching for ".bzr/".
Again, I realize that MemoryTransport is probably not used everywhere, but
I thought I would point out some small bugs.

(sorry I don't have a patch/branch to give you, but I'm on a machine
without bzr installed, using webmail, in a coffee house).

John
=:->





More information about the bazaar mailing list