EOSERV Wiki > Page: Patches > History > Revision Diff

Revision Diff: Patches

Revision by at 1st Jun 2011 02:47 am
DeletionsAdditions
===What is a Patch?===
A patch is a file that finds the differences between two files, allowing you to add the difference in code to your files.
===What could this be used for?===
This could be used for adding features to your server. It is a lot easier than a step-by-step instructional on adding it. It also saves a lot of time.
===What will I need?===
All you need is a diff/patch executable(along with a few .dlls). They are a pretty common thing and are included in gnuwin. If you don't have them, or don't know if you have them, then you can just click [[http:\\addison.us.to\files\patch\diffpatch.zip|here]] to download them. I'd suggest saving them to a easy, accessible place because they will be used a lot.
Let's get started.
Before you can begin creating/applying a patch, you have to get to the directory. Open your command-line, and go to the directory of where the diff/patch executables are located. You can do this by typing 'cd Location'. To make sure it works, you can type 'diff --help' or 'patch --help' and a bunch of text should pop up with help on how to use.<br />
Example: [[Link here]]
==Creating a Patch==
===One file===
Make sure you have the original(before you added code) and the updated file. In your command-line, type:
''diff originalFile updatedFile > filename.patch''<br />
Example: [[Link here]]
===Multiple files===
Make sure you have the original directory(before you added code) and the updated directory. In your command-line type:
''diff -rupN originalDirectory updatedDirectory > filename.patch''<br />
Example: [[Link here]]
==Applying a Patch==
===One file===
Make sure you have the patch file and the original file that was used to create it. In your command-line type:
''patch originalFile -i filename.patch -o fileToUpdate''<br />
Example: [[Link here]]
===Multiple files===
''Figuring this out still :P''
==Distributing Patches==
When you distribute a patch, I wouldn't just give them the patch file. Since, when you are using the patch command, you have to include the original(the file that does NOT include the updates) file, I would also include the original file then so it provides a less chance for your code to get messed up.
Below is a list of current patches for EOSERV. Feel free to add your own patch on there if it is not included already.
===List of Patches===
''None.''
EOSERV Wiki > Page: Patches > History > Revision Diff