Dev Week -- Bazaar and Launchpad - How to do it -- rockstar and beuno -- Fri, Jan 23


[18:05] <iulian> Next up is rockstar and beuno with "Bazaar and Launchpad - How to do it".
[18:05] <iulian> Rock on guys!
[18:05] <rockstar> Hi everyone.  My name is Paul Hummer, and I work on the Launchpad Code team.  Also with me is my cow orker, Martin Albisetti, who is awesome in his own rite.
[18:06] <rockstar> Today we're going to be talking about some good principles and practices for using bzr with Launchpad.  Most of these things are only suggestions, but I would say that they are very STRONG suggestions.
[18:06] <rockstar> First, some pre-requisites...
[18:06]  * beuno waves
[18:07] <rockstar> If you're not using bzr from the bzr ppa, you REALLY should be.
[18:07] <rockstar> It can be found here:
[18:07] <rockstar> This will make sure you're getting the best out of Bazaar, and in effect, the best out of Launchpad.
[18:08] <rockstar> I'm not sure if emmajane covered this in her session, but I can't stress enough the importance of setting your name in bzr.
[18:08] <rockstar> You can do this at the terminal by typing `bzr whoami` first.
[18:09] <rockstar> If I were to type that on this system without configuring it, it would return <rockstar@megatron>, as my system user is rockstar, and my system name is megatron.
[18:10] <rockstar> If it returns a <user@host> to you, you need to configure it.
[18:11] <rockstar> So you'll need to type `bzr whoami "Paul Hummer <"` obvious substitutions.
[18:11] <rockstar> ...apply
[18:11] <rockstar> Now bzr will know who attribute your revisions to.
[18:12] <holloway> sorry for the interrupt, you mean `bzr whoami "Paul Hummer <">` ?
[18:12] <rockstar> `bzr whoami "Paul Hummer <>"`
[18:12] <rockstar> Thanks for the clarification beuno
[18:12] <beuno> holloway, please head over to #ubuntu-classroom-chat for questions
[18:13] <beuno> apw, asked: QUESTION: is bzr whoami global or per checkout?
[18:13] <rockstar> Er, holloway, thanks.
[18:13] <holloway> yeah sorry
[18:13] <beuno> answer: global, although you can specify it per branch additionally
[18:14] <rockstar> apw, yes, what beuno said.  ~/.bazaar/locations.conf is where you'd set it per banch.
[18:14] <rockstar> s/banch/branch
[18:14] <rockstar> It's important that the email address you set here is one that Launchpad knows about (and it's confirmed).
[18:15] <rockstar> Launchpad will then look at those revisions, and say "I know this email address!  It belongs to X user!"
[18:15] <rockstar> Then, when you look at a branch's revisions, the ones that belong to you will be linked to your account.
[18:16] <rockstar> And, for those who are karma happy, you'll get karma for the revisions that belong to you.
[18:16] <rockstar> So, let's get on to the Launchpad part.
[18:16] <rockstar> You've got your project all set up, with it's accompanying branding bling, and now you're ready to make it host some code.
[18:17] <rockstar> For the next few examples, I'm going to use my username and a project I work on called Entertainer.
[18:17] <rockstar> So I have a branch that I'd like to be considered THE entertainer branch.  It's the one that releases will be cut from.
[18:17] <rockstar> Inside that branch I'll type `bzr push lp:~rockstar/entertainer/trunk`
[18:17] <rockstar> This will push up a branch of entertainer called trunk
[18:18] <rockstar> Now I need to make launchpad reflect that this is the Entertainer "trunk"
[18:18] <rockstar> I do that by setting it as the "Development Focus"
[18:18] <rockstar> This has a few side effects.
[18:19] <rockstar> The first is that I can now branch that same branch by typing `bzr branch lp:entertainer`
[18:19] <rockstar> Launchpad knows the development focus branch is lp:~rockstar/entertainer/trunk and so that's the branch I end up with.
[18:20] <beuno> < apw> QUESTION: how did you tell it that it was the Development Focus, was that a ticky somewhere in LP ?
[18:20] <rockstar> Also, when new users come to hack on my project (because that's Launchpad's best thing about it), they'll know where to focus their efforts.
[18:21] <rockstar> apw, if you go to you'll see a link that says trunk (focus of development)
[18:22] <rockstar> Click on that, and you'll see a link to the "trunk" branch.
[18:23] <rockstar> On the right hand side, you'll see a Link to branch link.
[18:23] <rockstar> That's how you would set it.
[18:24] <rockstar> I need to add a caveat here.  It's best to have you trunk branch owned by a team (this will require creating a team).
[18:24] <rockstar> This way, you don't block development landings when you go on vacation for two months.  Other members can merge branches into trunk while you're gone.
[18:26] <rockstar> Alright, moving on...
[18:26] <rockstar> Now we have the "trunk" set up.
[18:27] <rockstar> I'm going to context switch to act as a user named cthulu on Launchpad.
[18:27] <rockstar> I come to the entertainer project and I want to hack on it.
[18:27] <rockstar> The first thing I want to do is to get a local mirror of trunk.
[18:28] <crashsystems> I'm late
[18:28] <rockstar> The benefit of a local mirror of trunk is that it doesn't require internet connections to create a new branch.
[18:29] <rockstar> So I `bzr branch lp:entertainer` and now have a local branch called entertainer.
[18:29] <rockstar> So I branch from that one to fix bug 1234567 by doing `bzr branch entertainer bug-1234567`
[18:30] <rockstar> I can then go into the bug-1234567 branch, and push it to Launchpad by doing `bzr push lp:~cthulu/entertainer/bug-1234567`
[18:30] <beuno> 16:25 < DoruHush> QUESTION: How a sub-branch of a main branch of a project get registred. What steps a user should to register a sub-branch (his working bzr
[18:30] <beuno>                   branch in Launchpad, not localy ) ?
[18:30] <beuno> 16:26 < DoruHush> like another branch in a team project
[18:31] <rockstar> I blogged about some configuration settings that I use to make pushing simpler here :
[18:31] <rockstar> DoruHush, I think what you're asking is what I just went over.  Do you have other questions?
=== bac_lunch is now known as bac
[18:32] <rockstar> The branch for bug-1234567 is now registered with Launchpad as a hosted branch (notice I didn't have to use the Web UI at all.  Launchpad is so s-m-a-r-t)
[18:32] <beuno> < postalchris> Is the bug-XXXX branch name magically recognized by Launchpad, or are you using that as a personal convention?
[18:32] <rockstar> Personal convention really.
[18:33] <rockstar> However, this would be a good time to note a cool way to link your branch to a bug.
[18:33] <rockstar> So I (as cthulu) hack and commit a few times, and finally get the code that fixes bug 1234567.
[18:34] <rockstar> So when I commit, I'll type `bzr commit --fixes=lp:1234567`
[18:34] <rockstar> When that revision gets pushed, it'll automatically link the branch to the bug.
[18:35] <beuno>  newz2000> QUESTION: is there a convention you use when working on new features not driven by bugs?
[18:35] <rockstar> newz2000, not really.
[18:35] <rockstar> newz2000, for instance, I just created a branch called "do-some-important-things-with-unicode"
[18:36] <rockstar> Branch names are only limited by your own creativity.
[18:36] <rockstar> I suggest leaving out cursewords unless the branch absolutely warrants it.  :)
[18:37] <rockstar> james_w also notes "for the packagers amongst you if you use changelog bug closing and debcommit then (from intrepid onwards) the links will happen magically"
[18:37] <rockstar> Alright, moving on.
[18:38] <rockstar> So now cthulu has his branch all completed, with tests (because he wrote his tests first, right?), and he wants to see his work land in mainline.
[18:38] <rockstar> Mainline being "trunk"
[18:39] <rockstar> cthulu, however, doesn't have write privileges to trunk, and, frankly, teh Entertainer dev process is a little less "Wild west" with their commits.
[18:39] <rockstar> We require code reviews and all that.
[18:40] <rockstar> Looking at his branch page on Launchpad, cthulu then clicks "Propose for merging into another branch"
[18:41] <rockstar> He then follows the form through, setting it to land on trunk, and, since the Default Reviewer is set to Entertainer-Releases, he doesn't have to mess with that.
[18:41] <rockstar> Although, when I have a Launchpad branch that introduces new ui, I usually will request beuno to look at.  He's awesomer than me at that stuff.
[18:42] <rockstar> So now there's a new merge proposal showing cthulu's bug-1234567 branch as the "source branch" and lp:entertainer as the "target branch"
[18:43] <beuno> < apw> QUESTION: if i commited something --fixes=lp:123456 how can i see that in bzr on my branch?
[18:43] <rockstar> apw, on Launchpad, when you view either that branch or that bug, you'll see a link to the other.
[18:44] <apw> nothing on my local branch copy?
[18:44] <rockstar> apw,  not sure actually.  I've never had to do that.  beuno?
[18:44] <beuno> apw, I don't think we expose that through the command line
[18:45] <beuno> it's hidden meta-data that you can get out through the API
[18:45] <rockstar> apw, I think I could probably whip together a plugin for that data later.
[18:46] <rockstar> Alright, moving on to the review process.
[18:46] <rockstar> I (as myself again) get an email that there's a branch proposed for merging.
[18:47] <rockstar> First I get really excited to see a new contributor.
[18:48] <rockstar> Then I'll look at the branch, and usually look at a patch by doing `bzr merge lp:~cthulu/entertainer/bug-1234567` in my trunk mirror, and then `bzr diff` to look at the diff.
[18:48] <rockstar> Soon, Launchpad will generate that diff for you.
[18:49] <rockstar> I'll make comments and suggestions, and then I'll give it a vote.  For this example I'll vote "Needs Fixing"
[18:50] <rockstar> cthulu will then respond with justifications on why he did things the way he did, and fix the code to follow the Entertainer coding conventions.
[18:50] <rockstar> After I look at it again, I see the changes made, and I change my review vote to "Approve"
[18:51] <rockstar> At this point, the branch is ready to be merged.
[18:51] <rockstar> However, my band had an emergency tour to go on with my favorite band ever, so I disappear off the face of the planet for 6 months.
[18:52] <rockstar> Not to worry though, because there are other members of entertainer-releases that can merge (or "land") cthulu's changes into trunk.
[18:54] <rockstar> They do this by merging his branch into their local mirror copy, committing it (with a detailed commit message), and then pushing it up.
[18:54] <rockstar> Any questions?
[18:55] <rockstar> I should also mention that if you're prototyping something, and it doesn't have a project in LP, you can push what we call a "junk branch".
[18:56] <rockstar> We don't call it "junk" as a judgment of your coding skills, but because it's either going to become a project, or just scratch your itch.
[18:56] <beuno> < ia> QUESTION: how to create project at launchpad, so anyone else could download source via "bzr branch lp:<project>", not via "bzr branch
[18:56] <beuno>             lp:~<id>/+junk/<project>"?
[18:56] <rockstar> You can push a junk branch by doing "bzr push lp:~rockstar/+junk/total-hack"
[18:57] <rockstar> ia, creating a project is a pretty easy process.
[18:58] <rockstar> Then just pick up where I started in this session.
[18:58] <rockstar> Any other questions?
[18:59] <rockstar> Also, if a project you like is using CVS or Subversion, but won't give you access to their repo, you can set up an import branch.
[19:00] <rockstar> Import branches sync a CVS or SVN trunk to a bzr branch that you can branch from and hack on.
[19:01] <rockstar> This way, when you submit a patch to upstream, you also have a versioned path to creating that patch, instead of just having an svn checkout or something.
[19:01] <beuno> < LaserJock> QUESTION: so do you do all the code review via email?
[19:02] *beuno doesn't
[19:02] <rockstar> LaserJock, I do most of my code reviews via email, because I like to use Vim as I review a patch.
[19:02] <beuno> < LaserJock> QUESTION: is there any real advantage to using a vcs-import instead of bzr-svn?
[19:03] <rockstar> LaserJock, but I sometimes use the web interface.
[19:03] <rockstar> LaserJock, well, the real advantage is that a vcs-import will stay synced for you, instead of you having to sync it yourself.
[19:04] <LaserJock> rockstar: assuming the vcs-import stays in sync, right
[19:04] <rockstar> LaserJock, they usually do once the initial import is over.
[19:05] <rockstar> There is some work being done to the import system to make it even more robust.
[19:05] <LaserJock> .. I'll leave that one alone then ;-)
[19:06] <rockstar: The import system uses cscvs ( to import.  Patches welcome.
[19:07] <rockstar> <tyhicks> QUESTION: In terms of migrating a project to bzr/launchpad, is it possible to import the code from git and preserve all commit history?
[19:07] <rockstar> I know there is some work being done on bzr-git (/me looks at jelmer), but currently, the only way to import is using fastexport/fastimport
[19:08] <rockstar> Launchpad is planning on supporting git imports this year.
[19:10] <rockstar> Alright, thanks everyone!

MeetingLogs/devweek0901/BzrAndLp (last edited 2009-01-23 19:30:02 by pool-71-182-96-163)