[MERGE] HTTP redirection

Aaron Bentley aaron.bentley at utoronto.ca
Tue Feb 13 23:33:48 GMT 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Vincent Ladeuil wrote:
>>>>>> "aaron" == Aaron Bentley <aaron.bentley at utoronto.ca> writes:
>     aaron> Comment ("our only concrete control format") seems to be contradicted by
>     aaron> registering BzrDirFormat4, 5, 6.
> 
> 
> *control* format not BzrDir format, or am I misunderstanding
> something (the truth is the distinction is a bit blurry for me,
> but registries are distinct...) ?

TBH, I misunderstood at first.

But having reread carefully, I think this is incorrect.

The way it looks to me, control formats are formats of control
directories.  Examples would be 'CVS', '.svn', '{arch}', etc.  We
currently have only one type of control directory-- a '.bzr' control
directory.

The format is extremely basic.  It contains a "branch-format" file, a
README file, and a "branch-lock" directory.  BzrDirFormat is the class
for this.

Depending on the contents of the "branch-format" file, a BzrDir may
determined to be one of several subtypes, including BzrDirFormat4 and
BzrDirMetaFormat1.

The inheritance makes it a bit confusing, but when viewed as a control
dir, BzrDir is a concrete type, and the fact that it has subtypes is
best ignored.

>     aaron> I think we should be testing that redirecting bzrdirs
>     aaron> works with BzrDir.open, 
>     aaron> i.e. that the resulting transport base takes the
>     aaron> redirects into account.  It probably makes sense to
>     aaron> test open, open_from_transport,
>     aaron> open_containing_from_transport, and open_containing.
> 
> open, open_containing and open_containing_from_transport all end
> up calling open_from_transport and use the resulting BzrDir
> (which has two attributes transport and root_transport, both
> constructed from the transport probed by the format, i.e. the
> final target of the redirections).


> What will be the aim of the additional tests ? Again, I may be
> misunderstanding you and the test policy.

The idea was to ensure that future control formats did not change this.
 But since we always use BzrDir.open, there's no way for a subtype's
method to be invoked.  I guess it's a brainfart.

>     aaron> We should make a clear statement about how
>     aaron> open_containing works: does it follow the initial
>     aaron> redirect, or does it keep on altering the initial url
>     aaron> until BzrDir.open succeeds (by following a redirect to
>     aaron> a real branch)?
> 
> open_containing_from_transport have not changed. It tries all
> directories from the initial url to the root until it finds a
> branch or fail.

I think it would be good to add that information to
open_containing_from_transport's docstring.

> Have I answered your concerns ?

Mostly, but I think you should revert your control_dir change.  And
since I'm pretty sure you've introduced a new failure mode for bundles,
I think you should test for that, and correct it.

Pretty much every other user of get_transport is preparatory to creating
a bzrdir, so since none of our writable transports support redirection,
we don't need to worry about what do do if, for example, "bzr init
http://foo/bar" hits a redirection.

Aaron
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFF0krc0F+nu1YWqI0RAraTAJ9aVe/lqgKS9sTz0Mn+f7AhyzJozgCbBEm9
OCUdSVfLq8KzKrIlFEuZKss=
=Z3aE
-----END PGP SIGNATURE-----



More information about the bazaar mailing list