| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| How to prepare a (unified) patchOverview Intended Audience Prerequisites Steps Understand what a patch is Modify your document and ensure consistency Get ready Generate the differences Describe the patch Submit via Jira Real World Extension Multiple diffs in a single patch Other ways of obtaining source for diff comparison Tips References OverviewA "patch" is the set of differences between two versions of the same file. Patches are used to send someone the exact changes that you have made to your version of a program or a document. They can then apply that patch to their version to merge the changes and bring their version up-to-date with your version. As our example we use the contribution of a simple documentation patch for the Castor project. The principles apply to any project and to any type of file, e.g. *.xml, *.java, *.xsd, etc. Intended AudienceAnyone who wants to contribute to a project. This document addresses the basics, so as to get new people started. Our example describes the use of command-line tools for a UNIX system. Other tools can be used, as long as they produce a "unified diff". PrerequisitesContributers should have:
StepsHere is how to proceed. Understand what a patch isA "Patch" is the set of differences between two versions of the same file. A patch comprises one or more "diff" files. These diffs are produced by the program of the same name: diff. Here is an example of a single diff for one of the Castor How-to pages, where we are suggesting a minor text change. Do not get frightened. These are just human-readable instructions to the "patch" program.
That is a "unified diff" ... there a some lines of context on each side of the changes. This patch is basically saying "Change the text on line 208".
Modify your document and ensure consistencyLet us now go though the process of preparing that patch. Go ahead and edit your local copy of the document at $CASTOR_HOME/src/doc/jdo-howto.xml. Ensure that it is valid XML using your favourite XML editor or an external validating parser. Please do not leave it up to the poor committer to fix broken XML. Run the 'build doc' target to be sure that links are not broken and that the new document is presented as you intend it to be. Get readyIf you are using the HEAD of SVN then ensure that your working copy is up-to-date. Of course, if you are using a previous public release version of Castor, then it is already up-to-date. Generate the differencesPrepare the diff file. SVN will contact the remote repository, ensure that your working copy is up-to-date, then compare your local copy with the master repository.
Describe the patchPrepare a brief explanation of what your patch does. Get this ready in a text file before you go to Jira. See further hints about this in the "Description" section of the How-to Jira. What revision of SVN did you patch against? Was it HEAD branch? Was it a nightly build? Was it a public release? Submit via JiraTo contribute your patch to a specific project, use Jira - The Codehaus Issue Database. The procedure is explained in How to Contribute a Patch via Jira. Real World ExtensionMultiple diffs in a single patchA patchfile can contain the differences to various individual documents. For example, the following command does that ...
However, be careful not to go overboard with this technique. When producing multiple diffs in one patchfile, try to limit it to one particular topic, i.e when fixing the same broken external link in various pages, then it would be fine to produce a single diff. Consider the committer - they will find it hard to apply your patch if it also attempts to fix other things. Other ways of obtaining source for diff comparisonIdeally you will prepare your patches against a SVN repository. There are other ways to do this. They do create more work for the committers, however it may be the only way that you can do it. We would certainly rather receive your patch however it comes. As a matter of fact, we would politely ask you first to send us a unified patch. You could get the source document via the web interface to SVN. Here are the steps ...
Tips
References
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||