How to submit patches to wxWidgets |
by Vaclav Slavik and Vadim Zeitlin
Last update: February 19, 2005
User feedback and, especially, patches are very important for wxWidgets. They often help us improve wxWidgets' quality and fix bugs, so we are of course happy if you contribute them (how could we dislike your help, after all?). But we have all sort of problems with applying non-standard patches. To make life easier for both you and us, please follow the few simple rules below when submitting patches:
The advantage of using diff is that it produces one file with differences in all files you modified and what's more, diff files are small, easy to read and understand and can be applied even if the affected files have been changed since the moment when the patch was submitted.
The only exception to this rule is for the translations: unfortunately, .po files change a lot each time they are regenerated because all line numbers recorded in them change, and this risks making any patches to them unappliable very quickly. So for these files, and only for them, please submit the whole files and not patches to the existing ones. You can use diff program which is a standard part of most Unix systems and is available as part of cygwin package or elsewhere for Windows or, alternatively, you can just use cvs diff command which works almost in the same manner as diff if you are already using the cvs. The best way to make a patch is to use this command:
cvs diff -u > mypatch.patch
However, for this to work you should be online. If you are offline you can also type this command one level above your wxWidgets' root directory:
diff -ru -x"CVS" -x".#*" -x"*.orig" -x"*.rej" -x"*~" wxWidgets.orig wxWidgets > mypatch.patch
where wxWidgets.orig is the unmodified wxWidgets tree and wxWidgets is your patched copy. Note that you shouldn't speciify the r (recursive) switch when using cvs as it operates recursively by default. You may also prefer to give explicitly the names of the files you had modified as the command would run much faster then. Also, unless really, really impossible, please read diff's documentation so that you know what you are doing. However, just in case, a brief explanation: as we strongly prefer the universal diffs, you should use the u switch. 2 after it means to generate diffs with 2 lines of context and, finally, the x options tell diff to exclude temporary and backup files as well as the files private to the cvs itself.
cvs diff -r WX_2_2_BRANCH
This outputs the difference between the latest CVS version of 2.2 branch and your locally modified copy.
If your patch adds new feature or fixes something in development version, make it against freshly checked out CVS tree (see wxWidgets website for instructions on how to access it). If you cannot access CVS (for example when you are behind a firewall), make the patch against latest release or, better, against fresh CVS snapshot (downloadable from wxWidgets website).
Also, please make sure you fill-in the form correctly. In particular, assign proper Category and write explanatory summary. Summaries like "Implementation of new member-functions" or just "ownerdrw.cpp" are useless as they don't tell us anything about what the patch does (and these examples are unfortunately real). They are, in fact, the best way how to upset poor overloaded developers. An example of proper summary is "Fixes build problem under OS Foo in bar.cpp" or "Fixes to wxFileHistory so that it doesn't show nonexistent files".
If you provide detailed description of the patch, we will be able to apply it much faster -- and we will love you for submitting such nice patches :)
Remember that if you don't do it, another developer would have to write the documentation and the patch won't be applied it until he has time to do it.