Ubuntu – How to submit a patch to a Launchpad project

bazaargitlaunchpadpatch

With a Git/GitHub background and knowing very little about Bazaar VCS, I would like to occasionally report a bug to projects hosted on Launchpad, and even send a patch. I'd like to do it in a "proper" way so that it's ready for merging or improvement while not getting in way.

I can't seem to find a decent simple How-to suited for my needs.

What I did so far:

  1. I have created a Launchpad account,

  2. reported the bug,

  3. installed Bazaar and setup SSH keys etc.

Now if it was GitHub, I'd

  1. fork the repo,

  2. clone the forked repo,

  3. create a sanely named branch and do the work,

  4. commit + push,

  5. create a pull request using GitHub WUI.

But it's not GitHub, and both Launchpad and Bazaar architectures seem quite different from their GitHub/Git counterparts.

So could a kind soul save me from drowning in tons of documents and compile a straightforward step path, mainly the second part? Possibly including relevant CLI commands when they are needed?


Edit: It seems that I should clarify if I'm asking specifically about Ubuntu packages (whatever it means) or Launchpad projects.

I don't really care much about distinction between Ubuntu packages and non-Ubuntu packages. Any software could be in Ubuntu today and out of it tomorrow, or vice-versa. The development is what matters much more than distribution.

So I was assuming that

  • not every single package distributed in Ubuntu is hosted on Launchpad,

  • an "official" or "default" workflow for Launchpad exists (well if all devs can
    agree on using Bazaar, why couldn't most of them agree on a patching workflow?),

so I'm asking about the Launchpad way, not the Ubuntu way. And I chose AU because since the intersection is vast, I guess it's pretty on topic here.

Best Answer

Is it a Launchpad project?

(If you already know that it is a Launchpad project, you can skip this.)

Not all projects found on Launchpad are actually hosted and developed there - some are mirrors of code hosted elsewhere (GitHub/Gitorious/etc), others come from Debian. These original sources are known as "upstream" projects, and it is usually best to submit patches at the source and let the changes arrive "downstream" in Ubuntu (usually in the next release).

It should be clearly indicated on the project page whether it is hosted elsewhere or on Launchpad. If not, just ask the project maintainers how they wish to receive changes. Some upstream projects prefer simple patch files, others prefer submissions/pushes via their respective hosts.

As a special note, official Ubuntu packages (software stored in the official Ubuntu repositories that you can install from the Software Center) have a few different ways to submit patches, as many of those packages come directly from Debian, and should ideally be fixed there rather than only in Ubuntu. (This is a whole other question.)

How to submit a patch

The general way to submit a patch is that you make your branch, commit to it locally and push it back to Launchpad:

bzr push lp:~user/project/branch-name

You can then propose your branch to merge into the parent you branched from, either via the web site, or using the bzr lp-propose command.

If you've filed a bug, and your branch does fix it, be sure to do the following when committing, where 000000 is replaced with your bug number, assuming it is a bug reported on Launchpad, and not elsewhere instead.

bzr commit --fixes=lp:000000

A note on "default" workflow

This is pretty much the typical modern workflow, that you may compare to GitHub. Launchpad has been around a bit longer though, so this workflow evolved after the fact, rather than being built into the system from the beginning, so some older projects may rely on other methods of accepting patches. Most all newer projects rely on this workflow though, where on GitHub the "pull requests" have always been there, and people just default to using it because there was never a means to do something different on GitHub.