How do I use lightweight bazaar checkouts with Launchpad?

Asked by John Samuel Anderson

Is it possible to use bazaar more like Subversion or CVS, so that I don't have to download the entire history when starting a new feature branch?

Question information

Language:
English Edit question
Status:
Solved
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Solved by:
John Samuel Anderson
Solved:
Last query:
Last reply:
Revision history for this message
John Samuel Anderson (guitarmanvt) said :
#1

Yes, it is! (And I created this question so that others can find the answer, too.)

Here's the step-by-step process.

Step 1. Create your own branch on Launchpad.

It's documented that "bzr branch" works with two parameters. Thus, you can do something like this:

$ bzr branch lp:canonical-identity-provider lp:~guitarmanvt/canonical-identity-provider/taleo-sp

That does indeed create a branch on LaunchPad, without downloading anything locally. HOWEVER, LaunchPad shows that your new branch is "empty" and says that you need to push code. (But since you don't have any code locally, this message is a little confusing. Just ignore it for now.)

Step 2. Get a lightweight checkout of your branch.

You can run something similar to this:

$ bzr checkout lp:~guitarmanvt/canonical-identity-provider/taleo-sp

It goes a little faster than "bzr branch", though it does seem to do a lot of crunching at the end.

Running "bzr checkout" gets a copy of the code locally...but it also seems to do the initial "push" to the new LaunchPad branch. (THAT was a surprise to me.) In other words, LaunchPad will no longer call your branch "empty," but will instead show the last revision that was committed.

Step 3. Make changes and commit them.

Edit the source files and save them. Then issue this command:

$ bzr commit

Since you are using a lightweight checkout, "bzr commit" now works similar to Subversion (svn commit). Your change will show up on LaunchPad. (I found it to be much faster than "bzr push". I think this is because LaunchPad doesn't have so much to process.)

I hope this helps. (I'll be back to refer to it, myself.)

Revision history for this message
Michael Nelson (michael.nelson) said :
#2

Hi John,

in case it helps, I found light-weight checkouts so handy that i created a blog post... I didn't think of an LP question - great idea!

http://micknelson.wordpress.com/2011/05/19/sharing-your-development-environment-across-branches/

Revision history for this message
David Owen (dsowen) said :
#3

On 09/19/2012 07:45 PM, John Samuel Anderson wrote:
> Step 2. Get a lightweight checkout of your branch.
>
> You can run something similar to this:
>
> $ bzr checkout lp:~guitarmanvt/canonical-identity-provider/taleo-sp

That creates a heavy-weight checkout, which is basically a normal branch
that automatically pushes on every commit, and includes all branch history.

For a light-weight checkout, add the "--light" parameter:

$ bzr checkout --light lp:~guitarmanvt/canonical-identity-provider/taleo-sp

> It goes a little faster than "bzr branch", though it does seem to do a
> lot of crunching at the end.
>
> Running "bzr checkout" gets a copy of the code locally...but it also
> seems to do the initial "push" to the new LaunchPad branch. (THAT was a
> surprise to me.) In other words, LaunchPad will no longer call your
> branch "empty," but will instead show the last revision that was
> committed.

That was probably some pull behavior you saw, as it grabbed the entire
branch history. Also, LP sometimes takes a while to scan new branches
before it can show anything in those branches.

Revision history for this message
John Samuel Anderson (guitarmanvt) said :
#4

Thanks for pointing that out, David. So, the correct command in Step 2 is:

$ bzr checkout --lightweight lp:~guitarmanvt/canonical-identity-provider/taleo-sp