#define _PAGE_ How To Work With Patches #include "head.t"
When we speak of 'patches' in the Rockbox project, we mean a set of changes to one or more source files.
Use the tools 'diff' and 'patch'. Preferably the GNU versions. They're readily available for all imaginable platforms.
Try one of these:
We generate diffs (often called patches) using 'diff' in a manner similar to this:
diff -u oldfile newfile > patch
People who have checked out code with CVS can do diffs using cvs like this:
cvs diff -u file > patch
'diff' can also be used on a whole directory etc to generate one file with changes done to multiple:
diff -u olddir newdir > patch
The -u option means the output is using the 'unified diff' format. Older diff programs don't have that, and then -c (for 'context diff') is OK.
Applying a 'patch' (output from diff -u) is done with the 'patch' tool:
patch < patchfile
patch knows that the patchfile is a set of changes on one or more files, and will do those to your local files. If your files have changed too much for the patch to work, it will save the sections of the patch that aren't possible to apply in a file called "filename.rej" (filename being the name of the file for which the failing section was intended for). Then you must take care of them manually.
If there is path information in the patchfile that you want to cut off from the left, tell patch how many directory levels to cut off to find the names in your file system:
patch -p0 < patchfile patch -p1 < patchfile patch -p2 < patchfile... each example line removes one extra level of dir info from the left. #include "foot.t"