Using Eclipse to Build and Apply a Patch

A patch is a small piece of software designed to update or fix problems with a computer program or its supporting data. This includes fixing bugs, replacing graphics and improving the usability or performance.


Building a Patch

Building a patch in Eclipse is simple:

1. Use Eclipse to create a project from an SVN repository:

File > New > Project > Checkout projects from SVN

2. Revise the source code for the project until you solve the problem.

3. Create a patch. Eclipse will concatenate all of the changes you made to the source code:

 Right click on project > Team > Create patch...

4. Save the patch in a regular text file.

5. Submit the patch to the repository or email it to other software developers for further testing.

Applying a Patch

A developer can apply a patch file to his/her project in a few simple steps.

1. Open the apply patch wizard:

 Right click on project >Team >Apply patch 

2. Select the patch file and click next. Select the project to patch and click next.

3. In the next window you will be presented with a summary of the patch with files that will be touched. Initially the files may be listed as file does not exist. To apply the patch to the correct files:

 under Patch Options select Ignore leading path name segments until the matching files are found.  

4. Check the files you want to apply the patch to and click finish.

Reversing a Patch

  Right click on project > TEam > Revert 

Sample Patch

Here's an example of a VMOSS patch. Lines marked with --- name the original file. Lines marked with +++ name the edited file. Lines marked with + are new lines and lines marked with - are deleted lines. Expressions such as @@ -80,6 +80,7 @@ provide the exact location in the file.

Index: /Users/rmorelli/hfoss/workspace/vmoss110/mod/admin/
--- /Users/rmorelli/hfoss/workspace/vmoss110/mod/admin/	(revision 14)
+++ /Users/rmorelli/hfoss/workspace/vmoss110/mod/admin/	(working copy)
@@ -80,6 +80,7 @@
 	<li><b>Config Values</b>
 		<br />Customize VMOSS from the raw configuration values.
+		<br /><a href="index.php?mod=vm&act=admin&vm_action=help">Click here for Help</a>
Index: /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/controller/AdminController.php
--- /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/controller/AdminController.php	(revision 14)
+++ /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/controller/AdminController.php	(working copy)
@@ -249,6 +249,10 @@
 				//display the information
 				$this->displayACLAudit($bad_requests, $current_requests, $unclassified_tables, $dao->getDataClassificationLevels());
+			case 'help':
+				$this->displayHelp();
+			break;
Index: /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/templates/admin/help.tpl
--- /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/templates/admin/help.tpl	(revision 0)
+++ /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/templates/admin/help.tpl	(revision 0)
@@ -0,0 +1,19 @@
+<h2 style="text-align: center;">Help</h2>



+As an Admin User you will want to configure certain features of the The Volunteer Management Module. 



+<br />



+Currently VMOSS does not come preconfigured with locations--that is, countries, states, cities, etc. There

+are two ways to configure locations. One is manually, by inserting new countries, states, cities into the

+system.  The other way is to run a SQL script that contains all the locations for a given country.



+<br />

+<h4>Further Customizations</h4>


+Further customizations are available via the Administration menu, where you may add locations, organizations, and access control customizations.

\ No newline at end of file
Index: /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/templates/volunteer/portal.tpl
--- /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/templates/volunteer/portal.tpl	(revision 14)
+++ /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/templates/volunteer/portal.tpl	(working copy)
@@ -78,4 +78,7 @@
 <br />
 <br />
-<a href="index.php?mod=vm&act=volunteer&vm_action=help">Click here for Help</a>
\ No newline at end of file
+<a href="index.php?mod=vm&act=volunteer&vm_action=help">Click here for Help</a>
+<br />
+<a href="index.php?mod=vm&act=admin&vm_action=help">Click here for CONFIGURATION Help</a>
\ No newline at end of file
Index: /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/view/AdminView.php
--- /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/view/AdminView.php	(revision 14)
+++ /Users/rmorelli/hfoss/workspace/vmoss110/mod/vm/view/AdminView.php	(working copy)
@@ -150,6 +150,10 @@
 		$this->engine->assign('user_roles', $user_roles);
+	function displayHelp() {
+		$this->engine->display('admin/help.tpl');
+	}