How to submit patches to openXPS

Last update: August 12, 2005

User feedback and, especially, patches are very important for openXPS. They often help us improve openXPS' 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:

  1. Please try to send as few code as possible. If only possible, do NOT send us ZIP archives, whole files or even worse, only code snippetsé we prefer pathes. Patch is something that we could apply with one command, not arbitrary text that we'd spend hours trying to understand.

    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.

    You can use diff program which is a standard part of most Unix systems and is available as part of cygwin package 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 -bu2 > 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 openXPS' root directory:

    diff -ru2 -x"CVS" -x".#*" -x"*.orig" -x"*.rej" -x"*~" openXPS.orig openXPS > mypatch.patch

    where openXPS.orig is the unmodified openXPS tree and openXPS is your patched copy. Note that you shouldn't specify 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.

  2. Always make you patches against latest version of openXPS. If your patch fixes a bug in stable branch, make your patch against the latest release.

  3. cvs diff cannot make a patch which adds or removes a file, so you must use the standalone diff utility to do that (download from gnu if you don't have it, e.g. you're using WinCVS). Unlike cvs diff, diff works offline, so you need both original and modified versions of the openXPS directory hierarchy for diff to compare. Make a copy of your openXPS directory (but please don't name it "Copy of openXPS" because it has spaces in it) and use cvs on it to get the 'clean' copy of any files you've modified and want to make a patch for - this sets those files back to what's currently in CVS. Ensure you do a normal update on the development directory (with your modified files still in it) at the same time, so you don't unintentionally create a patch which reverts a previous patch. Ensure you run diff with the -N (or --new-file) option.

  4. Never edit the patch on a Windows system with an editor which can't handle/preserve the Unix like line termination.

  5. Do not split single code change into multiple patch. A patch should be self-contained -- one patch for one thing. A patch that adds bitmaps to menu items and fixes a bug in in another code is a bad patch. It should be splitted into two patches. On the other hand, two patches, one of them being "implementation of new member-functions", the other "changes in class description to accomodate new members" are two bad patches. They are related to one, logically indivisible, thing, so they should be part of one patch. Also note that it is not possible to upload multiple files at once -- this is why you should use diff which produces one small file. Another example: if you adapted the build system to work on new, previously unsupported platform, we would gladly accept your patch. Just please send us single patch, not 10 patches, one for each modified file.

  6. Please do not send the patches to the mailing lists, nor to any developer's personal email address. Instead, use the Patch Manager at SourceForge. Then you will be notified when the patch is accepted or if there is a problem with applying the patch.

  7. When you create new patch at SourceForge, please note that you MUST (this word should also be blinking but we'll spare you that) log in to SourceForge before submitting a patch as otherwise attaching the files will not work and, even worse, we won't be able to contact you to tell you about it nor any other potential problems with your patch!

    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".

  8. Describe the patch as precisely as possible in the Details field. Remember that it is often not easy to understand the purpose of your patch just from its source code. Alternatively, you may post a message explaining what your patch does to wxwindows-devel mailing list.

    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 :)

  9. Last but not least, if your patch adds a new feature please include the patch to the documentation as well as undocumented feature is hardly useful to anyone but its author. For the small patches the simplest and usually the best is to look at the existing documentation and update it to reflect your changes.

    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.

Thank you for reading this document -- and looking forward to your patches! :-)