storage branch - remaining issues?

John Arbash Meinel john at arbash-meinel.com
Thu Jan 19 23:07:53 GMT 2006


Aaron Bentley wrote:
> John Arbash Meinel wrote:
> 
>>>I thought '..' was not allowed in urls.
>>>
>>>I don't really care. I feel like the Transport layer is a nice
>>>centralized location where paths go through. Which means they can
>>>interpret the path, and everyone else can consider it a voodoo string.
> 
> 
> That is really unhelpful for anyone who wants to manipulate the path.

At what point do you need to manipulate the path? Is this done inside
bzr code before you have a branch/workingtree object?
Almost all the code gets to a Branch relatively fast.

> 
> 
>>>We could make Branch.open* be the conversion point, but if we are that
>>>deep, it is only 1 more step to get to Transport, since the first thing
>>>open() does is get_transport()
> 
> 
> I've already said I'd be willing to do the convertion in get_transport.
>  I am concerned that this may involve unicode decoding, and if so, we
> don't have enough data to know what encoding the string is in.
> 
> Aaron

All parameters passed on the command line have already been converted
into unicode, since the argument parser does that for you (using
bzrlib.user_encoding).
Internally in the code, we have a mix of unicode and plain strings,
since the current codebase didn't upgrade to unicode properly, and you
need unicode passed to os.listdir() to handle non-ascii paths.

I'm not sure what other paths could be passed in, but I would expect
LocalTransport to either be unicode path, or ascii path. And
http/sftp/ftp/etc should be url encoded, which would be utf-8 + url quoting.

I feel that is reasonable. If not unicode, LocalTransport can decode as
though it were utf-8 since that is a superset of ascii, and fail if it
doesn't decode. http/sftp/ftp should make sure they are valid utf-8 url
quoted strings. Though this is likely to be more of a sanity check,
since they only really need the url anyway.

Actually, I'm probably most concerned about the Branch.relpath()
functions. Since that would want to translate before passing it to
Transport.

I guess we might need something... But what and where? At what layer do
we do the encoding into URLs. We can require it to happen at the UI
layer of cmd_*. It just means lots of places doing it, rather than a
single place where the paths move through.

Bringing this up, can we factor out the cmd* stuff into a real UI layer?
builtins.py is definitely specific to the command line bzr program, and
it is arguable that commands.py and options.py are also. I realize
moving them breaks plugins, so it would probably have to go through the
'deprecated' cycle.

But if we define a ui layer, we can say "outside of this layer, all
paths are urls, there are no 'print' statements, etc"

John
=:->
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20060119/cd6db164/attachment.pgp 


More information about the bazaar mailing list