Open main menu

CDOT Wiki β

Changes

Working with Patches Lab

81 bytes removed, 10:49, 9 February 2010
Apply a patch
If the patch was created using cvs, do this:
 
$ cd src
$ patch -p0 < patch.txt
 
If the patch was created using hg, do this:
$ cd src
$ patch -p1 < patch.txt
* Here '''-p0p1''' means strip 0 1 leading directories from each filename in the patch (hg has a quirk which requires -p1 even though you'd use -p0 in the cvs case). We do this because we are in the same location (i.e., ./) as the person who created the patch. If the directories were mis-aligned, we would have to strip leading directories using -p1, -p2, etc.
* You can use the '''--dry-run''' option to test and see what would happen if you did apply the patch. Some people like to call patch with the -s or --silent or --quiet option (all do the same thing). This will suppress all output except error messages, and can make it easier to see which parts don't work.