All articles, tagged with “bazaar”

Problems with drive-by fixes

To start with, I think drive-by fixes are great. If you see that something is wrong when fixing something else, it can be a good idea to fix it right away, since otherwise you probably won’t do it.

However, even when doing drive-by fixes, I still think that each landed branch should focus on one thing only. As soon as you start to group unrelated things together, you make more work for others. It might be easier for you, but think about all the people that are going to look at your changes. Please, don’t be lazy! It doesn’t take much work to extract the drive-by fix into a separate branch, and most importantly to land it separately. If you do find that it’s too time-consuming to do this, let’s talk, and see what is taking time. There should be something we can do to make it easier.

There’s no such thing as a risk-free drive-by fix. There’s always the potential of something going wrong (even if the application is well-tested). When something goes wrong, someone needs to go back and look at what was done. Now, if you land the drive-by fix together with unrelated (or even related) changes, you basically hide it. By reducing your workload slightly, you create much more work for someone else.

For example, on Friday I saw that we had some problems with scripts in Launchpad. They were trying to write to a mail directory, to which they didn’t have access. That was odd, since scripts have always talked to the SMTP servers directly, and didn’t use the queued mailer that needed write access to that directory. Looking through the recent commit logs didn’t reveal anything. Luckily enough, William Grant pointed out that r9205 of db-devel contained a change to sendmail.py, which probably was the cause of the problems. This turned out to be correct, but it was still pretty much impossible to see why that change was made. I decided that the best thing to do was to revert the change, but I wasn’t sure exactly what to revert. That diff of that revision is more than 4000 lines, and more than 70 files were changed. So how can I know which other files were change to accommodate the change in sendmail.py. I tried looking at the commit logs, but that didn’t reveal much. The only thing I could do was to revert the change in sendmail.py and send it off to ec2, waiting three hours to see if anything broke.

So, I plead again, if you do drive-by fixes (and you should), please spend a few minutes extra, to extract the fix into a separate branch, and land it separately!

Is there maybe anything we can do to make this easier to do?

Wanted: bzr plugin to manage branches in Launchpad

I will probably implement this myself at some point, but if anyone wants to use their bzr and launchpadlib skills to make the world a slightly better place, I’d be grateful. You don’t even have to have any bzr and launchpadlib skills, both are quite easy to get started with. This could be a great opportunity to learn more about them!

I want a bzr plugin that queries Launchpad and list all my branches that aren’t Merged or Abandoned. I want it to work in the context of a branch, so that it automatically knows which project I’m interested in, although having it work outside a branch and list branches for all my projects would be useful as well.

To remove branches from the list of active branches, I’d also like to be able to mark a branch as Abandoned using the plugin.

Bonus points if any attached merge proposals and their status also are listed.

Using Launchpad to contribute to projects

While modifying pygarmin to support my Edge 305, I was faced with the problem how to submit my patches to be included in pygarmin; I don’t have commit access, so I can’t commit the changes myself. One way of doing it is of course to generate a diff, and attach a patch to their patch tracker. That has some problems, though, especially since I want to submit a series of patches. The main problem is how to get people to try out the patches. They would have to apply each patch to their version of the source code, and some patches might not apply cleanly after a while.

So, instead of submitting patches to their patch tracker, I make use of Launchpad. It has a nice feature that you can import the project’s source code and make it available as a bazaar branch. By importing the code, I can subscribe to pygarmin’s main branch in Launchpad, and get an e-mail notification when someone commits to the branch. But more importantly, I can now easily create a new branch to add support for my Garmin Edge 305:

bettan:~> bzr branch lp:pygarmin edge-305 Branched 82 revision(s).

Now I can hack on pygarmin and keep my changes versioned in bazaar, making it easier to keep my patches up-to-date. If code get commited to the trunk branch, I can simply merge and resolve the conflicts:

bettan:~/edge-305> bzr merge lp:pygarmin

The next thing I want to do is to publish my changes, so that other people can look at them. I do this by pushing my branch to Launchpad:

bzr push bzr+ssh://bjornt@bazaar.launchpad.net/~bjornt/pygarmin/edge-305

After doing this, the first time, the branch gets registered in Launchpad automatically, and the branch shows up under “Latest code” on the pygarmin page. People can now look and subscribe to my branch to see what changes I make. They can also choose “Browse code” to see the code, and see the diff of each revision I commit.

If I want someone to try out my changes, I can tell them to get my branch from Launchpad:

bzr branch http://bazaar.launchpad.net/~bjornt/pygarmin/edge-305