For i in $startdir/patches/$project/$version/.patch; doecho '.' tee -a patch.logecho '$i' tee -a patch.logpatch -b -verbose -strip=0 -input='$i' 2&1 tee -a patch.loggrep 'FAIL' patch.log && abort 'Patching failed.' DoneWhere:$startdir = Some directory that contains those specified subdirectories$project = software project, such as binutils, gcc, avr-libc, insight, etc.$version = version of the $project, such as 2.18 for binutilsNote that the 'patches' subdirectory in the script snippet above matches the 'patches' module in the WinAVR CVS repository.The main point is the 'patch' command. The switches that I use are:-b = Create backup-verbose = Enable verbose output-strip=0 = Do not strip any leading directories. This means that you should be at the top level of each project's directory tree when patching. All WinAVR patches are generated to use -strip=0.-input= = The actual patch filename that is used for input.HTHEric Weddington.
Cvs Create Patch File
Netbeans Apply Patch
Contents.diffThe unix 'diff' command shows the incremental differences in a text file or in a subdirectory of files. This is handy because you can only transfer what changed (and a little more for context) rather than redistribute everything. To get the differences between your code and a directory of the original code, you can simply do:diff -rupN original/ new/ original.patchThe -r specifies recursive, the -u specifies to output context lines, and the -p tells it to give specific C function names for context too.N says to treat absent files as empty.patchOnce you have this difference file, you can apply these differences using the 'patch' program. To update the original in our example, simply do a:patch original.patchYou can do a similar patch in CVS with:cvs diff -upN original.patchNote, that you could use this to 'undo' local changes and apply them back again later by using the 'reverse patch' option:patch -p0 -R fixcode.patchThen you can check the statistics about the patch with:git apply -stat fixcode.patchTo finally apply the patch, you do:git apply -check fixcode.patchIf you don't have any errors, you can commit the code and use the patch!