[BUG] transport/memory.py doesn't handle strings
Robert Collins
robertc at robertcollins.net
Wed Oct 19 01:23:59 BST 2005
On Tue, 2005-10-18 at 16:45 -0500, John A Meinel wrote:
> 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).
I think that the ambigious api is very strange. I'd much rather have
explict put_stream, put_string etc.
> Also, I would recommend including MemoryTransport into the test suite.
What do you mean by that ? (There are comprehensive tests for
MemoryTransport).
> 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).
Yes, and they do stuff to local disk and check that it worked. Its uhm,
difficult to do that with an in memory only transport.
> 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.
In bzrlib/branch.py, cloning at the top is checked for by
'new_transport.base == old_transport.base'. I was duplicating that
interface.
> 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.
Right, this is the interface I was coding for, because that is how your
current local transports appeared to indicate that they had failed to
chdir.
> (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).
No probs.
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/20051019/ed68e4b9/attachment.pgp
More information about the bazaar
mailing list