## page was renamed from DavidFutcher/PatchMergeRequests <> == Converting a patch into a merge request == If a patch applies to a project maintained in Launchpad, you can create a code branch with the patch applied and request that it is merged into the project's Trunk branch. [[https://help.launchpad.net/Code/Review | Merge requests]] can save time for project maintainers as they do not have to manually apply the patch themselves. == Walkthrough == * Check if the bug's Upstream project is maintained in Launchpad. You can use the [[https://edge.launchpad.net/projects | Launchpad project search]] to help you. * If it is maintained in Launchpad use [[http://doc.bazaar.canonical.com/bzr.2.0/en/ | BZR]] to download the projects Trunk code branch. For example to download Gwibber's trunk run {{{ bzr branch lp:gwibber }}} * Download the patch and apply it in the directory you just downloaded {{{ cd gwibber wget https://www.launchpadlibrarian.net/gwibber.patch patch -p0 < gwibber.patch }}} * Commit the new code to the branch with a message describing what the patch fixes/implements. Use the {{{--fixes lp:xxxxx}}} argument to automatically link the bug report to your branch. {{{ bzr commit -m "Apply patch to fix segfaults" --fixes lp:60833 }}} * We can now push the code onto Launchpad. Launchpad will automatically register a new branch when you push your new code. The location to push to follows this format {{{lp:~username/project/name-of-branch}}}. The name of the branch should describe the fix, commonly just the bug number is used: {{{ bzr push lp:~bobbo/gwibber/bug60833 }}} * Now we file a merge request. You can request a merge by visiting {{{https://code.launchpad.net/~username/project/branchname/}}} (alternatively use the command {{{bzr lp-open}}} in the branch directory to automatically open the page) and clicking on "Propose for merging". You will normally want to merge into the main branch, which is marked a "development focus" on the merge request page. You should try to give a detailed description of what changes the patch makes and at some point mention the bug number (however, your branch should be automatically linked to the bug report if you used the {{{--fixes}}} argument when committing). Click on "Propose Merge" to submit the merge request. * You should add a comment to the bug report explaining you have requested a merge and link to the request page. == More Information == * [[https://wiki.ubuntu.com/Bugs/HowToFix | How to fix bugs]] - Informaton on setting up your Launchpad account & Bazaar * [[https://wiki.ubuntu.com/Bzr | Ubuntu's BZR documentation]] - How to use Bazaar * [[https://help.launchpad.net/Code/Review | Launchpad's code review docs]] - Merge requests in more detail * [[http://doc.bazaar.canonical.com/bzr.2.0/en/ | Official BZR docs ]] - More Bazaar guides & docs