redirect from branch/.bzr

Bug #39015 reported by David Allouche
8
Affects Status Importance Assigned to Milestone
Launchpad itself
Fix Released
Medium
James Henstridge

Bug Description

Some people try checking bzr branches from the branch page on launchpad.net. We should provide an appropriate redirection.

If $URL is the canonical URL of a Branch in Launchpad (e.g. https://launchpad.net/people/bzrk/+branch/bzrk/dev), then $URL/.bzr should redirect to $TARGET/.bzr.

$TARGET would be BranchView.url (the Branch.url if it is set, fallback to the supermirror URL).

It's unclear what should be the correct redirection code. 303 was suggested at first, but I think 302 would be more appropriate. See http://www.w3.org/Protocols/HTTP/HTRESP.html for the documentation of the HTTP status codes.

Two pagetests would be needed: one for redirection from $URL/.bzr where Branch.url is set. One for redirection of $URL/.bzr where Branch.url is NULL.

It would be nice to also implement an end-to-end test to check that bzr correctly handles the redirection, but that would be much more complicated.

Tags: lp-code ui
Christian Reis (kiko)
Changed in launchpad:
assignee: nobody → kiko
status: Unconfirmed → Confirmed
Revision history for this message
James Henstridge (jamesh) wrote :

Before implementing this, bzr would need to handle redirects correctly as described in bug 36004.

If $LPBRANCHURL/.bzr redirects to $TARGET/.bzr and that branch is inside a repository, bzr needs to look for the repository relative to $TARGET rather than $LPBRANCHURL or it won't be able to use the branch.

David Allouche (ddaa)
Changed in launchpad-bazaar:
importance: Medium → Wishlist
Revision history for this message
James Henstridge (jamesh) wrote :

I had an idea of how we can implement this without signficant burden on the app server with current releases of bzr. We only need to serve 3 files without any HTTP redirects:

 * .bzr/branch-format with contents "Bazaar-NG meta directory, format 1"
 * .bzr/branch/format with contents "Bazaar-NG Branch Reference Format 1"
 * .bzr/branch/location with the HTTP URL of the branch.

I just tried putting this simple file structure on a local web server, and I was able to branch from it successfully. The recorded parent branch was the real Bazaar branch rather than the branch reference I created.

So this should result in the bzr client making 3 requests to https://launchpad.net when creating the branch, with all further requests going to http://bazaar.launchpad.net/.

Changed in launchpad-bazaar:
assignee: kiko → jamesh
Revision history for this message
David Allouche (ddaa) wrote :

I love this idea. It should be quite simple to implement and give us all we need. Also, all the db schema prerequisites are now present. That would be a great one-afternoon hack to put toghether.

Changed in launchpad-bazaar:
importance: Wishlist → Medium
Revision history for this message
James Henstridge (jamesh) wrote :

Did up a quick implementation of this last night.

Changed in launchpad-bazaar:
status: Confirmed → In Progress
Revision history for this message
David Allouche (ddaa) wrote :

got cherrypicked in production just today

Changed in launchpad-bazaar:
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.