1
edit
Changes
→Apply a patch
This lab is designed to give you first-hand experience creating and applying patches, and doing incremental builds of your source tree. The concepts introduced in this lab will help you understand how to make small changes to your tree, share those with others, or use other people's changes.
== Instructions ==
$ cd mozilla
$ patch -p0 < patch.txt
(unless you are using hg checkout/patches then you want to look here [https://developer.mozilla.org/en/Mercurial_FAQ#How_can_I_diff_and_patch_files.3f for updated instructions])
* Here '''-p0''' means strip 0 leading directories from each filename in the patch. 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.
=== Applying a real patch ===
* Apply the patch, using what you learned above. Remember the '''--dry-run''' option and to examine the paths of files in the patch.
$ cd mozilla/''objdir''
$ cd modules/libimg $ make $ cd ../libpr0n $ make $ cd ../../browser/app $ make cleanxpcom
$ make
=== Life-cycle of a patch in review ===
== Resources ==
* [http://developer.mozilla.org/en/docs/Creating_a_patch Creating a patch for Mozilla]
* [http://developer.mozilla.org/devnews/index.php/2007/07/10/getting-a-patch-checked-in/ Instructions for getting a patch checked into the tree]
* There are many tutorials on using diff/patch, for example [http://tools.devchannel.org/devtoolschannel/04/06/02/1521207.shtml?tid=46 this one].