Patches



Who Can Submit Patches
We welcome any and all patch contributions. Patches can range from spelling and grammar fixes to bug fixes and minor new features. (Major new features should be developed in a branch and be committed on a bit-by-bit basis. Instructions for requesting your own branch)
Where to Submit Patches
  • Patches should be submitted to developers by attaching a patch file to a Trac ticket.
  • If your patch is not addressing an existing OpenMRS ticket, then first search for an existing ticket and ask within the forum or mailing lists before creating a new ticket. If you cannot find an existing ticket and the folks in the developers mailing list have recommended that you make a new ticket, then you'll need to [create a new ticket].
  • Attach your patch to the ticket along with a description of your patch.
  • If you have been talking with a developer about a certain issue and/or feature, assign the patch ticket to that developer. If you are not sure who to assign the ticket to, assign it to the patch manager (see explanation below)
How to Create Patches
  • A patch file is simply a text diff (delta) between the latest working copy and your changes. It can contain multiple files.
  • Patch files can be created with your subversion tool of choice -- both Subclipse and TortoiseSVN have "Create Patch" options. Right click on the highest parent folder (usually root) to create one big patch file.
    1. Save the patch to a file with the extension of .patch (not *.txt or *.patch.txt)
    2. (not needed if done with latest subclipse and you choose "Project" as the "patch root") Edit the patch in a text editor and use search & replace to remove the absolute file path up to and including the name of your local copy. For example, if the files are named C:/Documents and Settings/Homer/My Workspaces/openmrs-project/src/org/openmrs/..., then you should remove all instances of "C:/Documents and Settings/Homer/My Workspaces/openmrs-project/" within the file.
    3. Upload your .patch file as an attachment within the appropriate ticket on the OpenMRS Development website (trac).
Patch Manager
The patch manager is a person that prevents any potential code contributions from falling through the cracks. The role of the manager is to follow up on patch tickets that have not been closed and to assign developers to review and/or apply patches that have been submitted.
The current patch manager is Ben Wolfe (bwolfe).
See the trac report showing all submitted patches: http://dev.openmrs.org/report/22
How to Apply Patches
(for patch managers not named Ben)
  1. Check to make sure the corresponding Trac ticket has a Code Review Status of "Approved".
  2. Download the patch file from the corresponding Trac ticket.
  3. SVN Checkout/Update the trunk branch (backports to a specific version branch will follow the same procedure).
  4. Apply the patch to your checked out copy of the trunk branch.
  5. Apply changes from the Code Review notes for this particular patch.
  6. [In Eclipse] Right-click on the project and select the "Compare with ... Base Revision" option.
  7. Review all differences as a sanity check that all files are included and all changes are correct.
  8. SVN Commit the changes, with a commit message that includes the patch author and a short description of the patch.
  9. Resolve the ticket as closed, with a comment that includes the revision number in square braces: [123].

Sample commit message

Applying patch that does feature x or fixes bug y. see ticket #123
author: bwolfe

Sample closed ticket comment

Fixed in changeset [5678]

Internet Resources