Note: You are currently viewing documentation for Moodle 1.9. Up-to-date documentation for the latest stable version is available here: Patch.
A patch, sometimes also called a diff, is a file that shows what changes have been made to a file, or group of files. They are a common way for developers to exchange changes to software. For practical instructions see:
For more information about the patch format, read on. Here is a simple sample patch file:
Index: lang/en_utf8/quiz.php =================================================================== RCS file: /cvsroot/moodle/moodle/lang/en_utf8/quiz.php,v retrieving revision 220.127.116.11 diff -u -r18.104.22.168 quiz.php --- lang/en_utf8/quiz.php 29 May 2007 17:47:25 -0000 22.214.171.124 +++ lang/en_utf8/quiz.php 25 Jun 2007 12:58:34 -0000 @@ -252,7 +255,6 @@ $string['indivresp'] = 'Responses of Individuals to Each Item'; $string['info'] = 'Info'; $string['introduction'] = 'Introduction'; -$string['invalidcategory'] = 'Category ID is invalid'; $string['invalidnumericanswer'] = 'One of the answers you entered was not a valid number.'; $string['invalidnumerictolerance'] = 'One of the tolerances you entered was not a valid number.'; $string['invalidsource'] = 'The source is not accepted as valid.'; @@ -375,8 +377,10 @@ $string['questiontypesetupoptions'] = 'Setup options for question types:'; $string['quiz:attempt'] = 'Attempt quizzes'; $string['quiz:deleteattempts'] = 'Delete quiz attempts'; +$string['quiz:emailconfirmsubmission'] = 'Receive own quiz submission notification'; +$string['quiz:emailnotifysubmission'] = 'Receive student quiz submission notifications'; $string['quiz:grade'] = 'Grade quizzes manually'; -$string['quiz:ignoretimelimits'] = 'Ignores time limit on quizzes'; +$string['quiz:ignoretimelimits'] = 'Ignores time limit on quizs'; $string['quiz:manage'] = 'Manage quizzes'; $string['quiz:preview'] = 'Preview quizzes'; $string['quiz:view'] = 'View quiz information';
At the top it says which file is being affected. Changes to several files can be included in one patch. Lines added are shown with a '+', lines removed are shown with a '-', lines changed are shown as the old line being removed and the new one added.
Patch files are good because they only show the changed parts of the file. This has two advantages: it easy to understand the change; and if other parts of the same files change between the patch being made an being used, there is no problem, the patch will still apply.
Note that there are several slight variants of the patch format. The example above is a 'unified' patch, which is now the standard.