== Dev Week -- Bazaar and Launchpad - How to do it -- rockstar and beuno -- Fri, Jan 23 == UTC {{{ [18:05] Next up is rockstar and beuno with "Bazaar and Launchpad - How to do it". [18:05] Rock on guys! [18:05] 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] 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] First, some pre-requisites... [18:06] * beuno waves [18:07] If you're not using bzr from the bzr ppa, you REALLY should be. [18:07] It can be found here: https://edge.launchpad.net/~bzr/+archive/ppa [18:07] This will make sure you're getting the best out of Bazaar, and in effect, the best out of Launchpad. [18:08] 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] You can do this at the terminal by typing `bzr whoami` first. [18:09] If I were to type that on this system without configuring it, it would return , as my system user is rockstar, and my system name is megatron. [18:10] If it returns a to you, you need to configure it. [18:11] So you'll need to type `bzr whoami "Paul Hummer ...apply [18:11] Now bzr will know who attribute your revisions to. [18:12] sorry for the interrupt, you mean `bzr whoami "Paul Hummer ` ? [18:12] `bzr whoami "Paul Hummer "` [18:12] Thanks for the clarification beuno [18:12] holloway, please head over to #ubuntu-classroom-chat for questions [18:13] apw, asked: QUESTION: is bzr whoami global or per checkout? [18:13] Er, holloway, thanks. [18:13] yeah sorry [18:13] answer: global, although you can specify it per branch additionally [18:14] apw, yes, what beuno said. ~/.bazaar/locations.conf is where you'd set it per banch. [18:14] s/banch/branch [18:14] It's important that the email address you set here is one that Launchpad knows about (and it's confirmed). [18:15] Launchpad will then look at those revisions, and say "I know this email address! It belongs to X user!" [18:15] Then, when you look at a branch's revisions, the ones that belong to you will be linked to your account. [18:16] And, for those who are karma happy, you'll get karma for the revisions that belong to you. [18:16] So, let's get on to the Launchpad part. [18:16] 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] For the next few examples, I'm going to use my username and a project I work on called Entertainer. [18:17] 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] Inside that branch I'll type `bzr push lp:~rockstar/entertainer/trunk` [18:17] This will push up a branch of entertainer called trunk [18:18] Now I need to make launchpad reflect that this is the Entertainer "trunk" [18:18] I do that by setting it as the "Development Focus" [18:18] This has a few side effects. [18:19] The first is that I can now branch that same branch by typing `bzr branch lp:entertainer` [18:19] Launchpad knows the development focus branch is lp:~rockstar/entertainer/trunk and so that's the branch I end up with. [18:20] < apw> QUESTION: how did you tell it that it was the Development Focus, was that a ticky somewhere in LP ? [18:20] 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] apw, if you go to https://edge.launchpad.net/entertainer you'll see a link that says trunk (focus of development) [18:22] Click on that, and you'll see a link to the "trunk" branch. [18:23] On the right hand side, you'll see a Link to branch link. [18:23] That's how you would set it. [18:24] 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] 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] Alright, moving on... [18:26] Now we have the "trunk" set up. [18:27] I'm going to context switch to act as a user named cthulu on Launchpad. [18:27] I come to the entertainer project and I want to hack on it. [18:27] The first thing I want to do is to get a local mirror of trunk. [18:28] I'm late [18:28] The benefit of a local mirror of trunk is that it doesn't require internet connections to create a new branch. [18:29] So I `bzr branch lp:entertainer` and now have a local branch called entertainer. [18:29] So I branch from that one to fix bug 1234567 by doing `bzr branch entertainer bug-1234567` [18:30] 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] 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] branch in Launchpad, not localy ) ? [18:30] 16:26 < DoruHush> like another branch in a team project [18:31] I blogged about some configuration settings that I use to make pushing simpler here : http://theironlion.net/blog/2009/01/13/using-bazaar-launchpad-making-pushing-easy/ [18:31] 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] 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] < postalchris> Is the bug-XXXX branch name magically recognized by Launchpad, or are you using that as a personal convention? [18:32] Personal convention really. [18:33] However, this would be a good time to note a cool way to link your branch to a bug. [18:33] So I (as cthulu) hack and commit a few times, and finally get the code that fixes bug 1234567. [18:34] So when I commit, I'll type `bzr commit --fixes=lp:1234567` [18:34] When that revision gets pushed, it'll automatically link the branch to the bug. [18:35] newz2000> QUESTION: is there a convention you use when working on new features not driven by bugs? [18:35] newz2000, not really. [18:35] newz2000, for instance, I just created a branch called "do-some-important-things-with-unicode" [18:36] Branch names are only limited by your own creativity. [18:36] I suggest leaving out cursewords unless the branch absolutely warrants it. :) [18:37] 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] Alright, moving on. [18:38] 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] Mainline being "trunk" [18:39] 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] We require code reviews and all that. [18:40] Looking at his branch page on Launchpad, cthulu then clicks "Propose for merging into another branch" [18:41] 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] 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] 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] < apw> QUESTION: if i commited something --fixes=lp:123456 how can i see that in bzr on my branch? [18:43] apw, on Launchpad, when you view either that branch or that bug, you'll see a link to the other. [18:44] nothing on my local branch copy? [18:44] apw, not sure actually. I've never had to do that. beuno? [18:44] apw, I don't think we expose that through the command line [18:45] it's hidden meta-data that you can get out through the API [18:45] apw, I think I could probably whip together a plugin for that data later. [18:46] Alright, moving on to the review process. [18:46] I (as myself again) get an email that there's a branch proposed for merging. [18:47] First I get really excited to see a new contributor. [18:48] 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] Soon, Launchpad will generate that diff for you. [18:49] I'll make comments and suggestions, and then I'll give it a vote. For this example I'll vote "Needs Fixing" [18:50] 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] After I look at it again, I see the changes made, and I change my review vote to "Approve" [18:51] At this point, the branch is ready to be merged. [18:51] 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] Not to worry though, because there are other members of entertainer-releases that can merge (or "land") cthulu's changes into trunk. [18:54] 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] Any questions? [18:55] 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] 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] < ia> QUESTION: how to create project at launchpad, so anyone else could download source via "bzr branch lp:", not via "bzr branch [18:56] lp:~/+junk/"? [18:56] You can push a junk branch by doing "bzr push lp:~rockstar/+junk/total-hack" [18:57] ia, creating a project is a pretty easy process. https://edge.launchpad.net/projects/+new [18:58] Then just pick up where I started in this session. [18:58] Any other questions? [18:59] 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] Import branches sync a CVS or SVN trunk to a bzr branch that you can branch from and hack on. [19:01] 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] < LaserJock> QUESTION: so do you do all the code review via email? [19:02] *beuno doesn't [19:02] LaserJock, I do most of my code reviews via email, because I like to use Vim as I review a patch. [19:02] < LaserJock> QUESTION: is there any real advantage to using a vcs-import instead of bzr-svn? [19:03] LaserJock, but I sometimes use the web interface. [19:03] 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] rockstar: assuming the vcs-import stays in sync, right [19:04] LaserJock, they usually do once the initial import is over. [19:05] There is some work being done to the import system to make it even more robust. [19:05] .. I'll leave that one alone then ;-) [19:06] 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] 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] Launchpad is planning on supporting git imports this year. [19:10] Alright, thanks everyone! }}}