ddaa bbloggs: /launchpad/bzr-hosting

Community Bazaar Hosting on Launchpad

You could already register bzr branches on Launchpad, provided you had some web space to put them on. Now, you can host your bzr branches directly on Launchpad.

You can register a bzr branch you are hosting elsewhere using your web browser. This is called an external branch, and will be automatically mirrored on a daily basis.

To ask Launchpad to host a branch for you, use the bzr tool to connect to the bazaar.launchpad.net SFTP server and upload your branch. This is called a hosted branch.

I have discussed external branches before. The rest of this article discusses how to set up and use a hosted branch.

For this recipe you will need:

  • A Launchpad account. If you do not have one yet, you can register.
  • A Bazaar branch. If you do not have that yet, there are tutorials to get you started.

Branches are uploaded to Launchpad using the SFTP protocol. Authentication is done using the SSH public key system. The Ubuntu wiki has a good SSH Howto covering public key authentication and ssh-agent.

Once you have a SSH public key, register it in Launchpad: go to your account page, click on SSH Keys in the top left corner, and enter your public key in the form.

To push a branch to Launchpad, you need three pieces of information.

  1. The name of your account: this is the last part of the URL of your account page, and you can modify it in the Personal details form accessible from your account's page.
  2. The name of the Launchpad product the branch belongs to. The name of the product is the last part of the URL of the product page.
  3. The name of the branch to publish. This name must be unique for an owner and product, but the same name can be used by different users in the same product and by the same user in different products. If you have no idea, "dev" is a good name for an all-purposes development branch.

In the following examples, substitute account with your account name, product with a product name, and branch with the branch name.

For convenience, you can record your Launchpad account name in your ~/.ssh/config file, by adding the following lines:

Host bazaar.launchpad.net
    User account

Then you can push a branch on Launchpad using the following command:

bzr push --create-prefix sftp://bazaar.launchpad.net/~account/product/branch

Update: As Jamesh Henstridge reported, it is no longer necessary to use the --create-prefix option when pushing to bazaar.launchpad.net.

bzr push sftp://bazaar.launchpad.net/~account/product/branch

After the push, the branch appears on the Launchpad web site and you can use it to set a title, description, and various other attributes of the branch. The Launchpad page for the branch will be found at this URL:

https://launchpad.net/+people/account/+branches/product/branch

Update: The URL structure of the web site changed, /+people/name was replaced by /~people.

https://launchpad.net/~account/+branches/product/branch

After pushing, the branch data will be published at this URL, advertised on the branch page:

http://bazaar.launchpad.net/~account/product/branch.

There is some latency between the time a branch is pushed to SFTP and the time when the data published by HTTP is updated. This latency is currently one day, but new code will be deployed soon bringing this down to a few minutes.

Update: The latency reduction work has been deployed

It can be a few minutes between the time a branch is pushed to SFTP and the time when the data published by HTTP is updated. Usually, this delay is two minutes.

Now, a more negative note, the things you cannot currently do with branches on Launchpad:

  • Push to a external branch that was registered on the Launchpad web site.
  • Convert a branch between hosted and external. Once the branch is created, it will either be mirrored from an external URL, or published from the SFTP area.
  • Use the bzr repository feature. At the moment, each hosted branch must be self contained.

A branch can also be owned by a team, allowing multiple users to commit. More on this next time!

Update: James Henstridge talked about shared branches and Andrew Bennetts emphasized how Bazaar checkouts are useful.

Thanks to Malcolm Cleaton, James Henstridge, and Stuart Bishop for proof-reading this article and suggesting numerous improvements.

15 Jun. 2006 Community Bazaar Hosting on Launchpad (5 comments)

Posted by olivier at Thu Jun 15 20:01:49 2006

Nice work!

Do you plan adding browsing features of the bzr branches (a bit like what trac does for svn) in the long term?

Posted by ddaa at Sun Jun 18 16:24:13 2006

There is a such a plan: bug 49991. Hopefully, it will be realized in the less than long term.

Posted by mike at Wed Sep 6 08:37:42 2006

It took me forever to figure out why I couldn't push to sftp locations. Turns out that while I did have bzr and bzrtools and bzrk installed, what I also needed was python-paramiko...

Posted by bialix at Mon Nov 6 07:38:41 2006

Note for your article: If user's login name on machine is different from launchpad account name, then user should specify launchpad account name during sftp:

bzr push --create-prefix sftp://account@bazaar.launchpad.net/~account/product/branch

Posted by Juri Pakaste at Fri Nov 24 17:58:04 2006

Just for the record, as this is the only place where I found documentation for this:

https://launchpad.net/+people/account/+branches/product/branch

seems to be wrong, it's really

https://launchpad.net/people/account/+branch/product/branch