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

Robert Collins robertc at robertcollins.net
Sun Nov 13 18:45:27 GMT 2005


On Sun, 2005-10-23 at 09:22 -0500, John Arbash Meinel wrote:
> > 
> > I think we should modify transport so that
> > 'LocalTransport('/').clone('..') raises an exception.
> 
> That is a valid way of doing it, which I considered. I just know that
> ordinary practice of "cd /; cd .." is perfectly valid, and leaves you in
> the root directory.
> 
> Which meant that I wouldn't get an exception by default, and so I would
> have to do a string check against whether or not I was at the root for
> every clone. Not a big deal.
> 
> I usually avoid using exceptions as return values, but it isn't terrible.

The reason I suggest using an exception, is that currently the following
will give confusing results:

def sibling_bin(path)
 return LocalTransport(path).clone('..').clone('bin')

for '/' -> '/bin/'
for '/usr/' -> '/bin/'

An exception will make 'TopOfTree' explicit.

Aaron - we have a programmatic interface, we should use it to signal as
clearly as possible :). At the moment we obfuscate information by not
signaling a boundary condition clearly.

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/20051114/47b9270c/attachment.pgp 


More information about the bazaar mailing list