Patching Files

From XMBdocs

by JDaniels

How To:

Each file has a section in the diff file. The header looks like this:

diff -ur releases/XMB-1.9.9-Saigo/Files/include/validate.inc.php XMB-1.9.9-Saigo/Files/include/validate.inc.php
--- releases/XMB-1.9.9-Saigo/Files/include/validate.inc.php	2008-03-25 14:34:44.000000000 -0600
+++ XMB-1.9.9-Saigo/Files/include/validate.inc.php	2008-04-03 22:52:36.000000000 -0600

In this example, the changes are going to be made to include/validate.inc.php.

Following that, there are line numbers of the old file and new file. This denotes the affected section of code of each file:

@@ -509,6 +509,6 @@

Then comes the code change itself. Lines that begin with a + (plus) are lines that need to be inserted. Lines that begin with a - (minus) are lines that need to be removed. Lines that do not begin with either, are unchanged reference lines to help locate the section of code.

 }
 
 function isValidFilename($filename) {
-    return preg_match(\\\'#^[^:\\\\\\\\/?*<>|]+$#\\\', trim($filename));
+    return preg_match(\\\'#^[\\\\w\\\\. ]*$#\\\', $filename);
 }
 ?>

The automated patching tool we use for Windows is called TortoiseMerge, included in the SVN utlities.

TortoiseSVN

There is also a utility called patch that will try and make the changes for you.

Windows Version

*nix Version

If you have any questions or concerns, please ask them in the General Support Forum.