CSE 70, Fall 2008
Software Engineering
Lab 5 Instructions
Apply a patch to your team repository.
First, save and view the file layout.patch.
It's what we call a "patch file" or a "diff".
Notice how it describes differences between two versions of a file
(or multiple files).
Apply the patch using the command-line program patch.
-
In the
trunk directory of your team's project, run
patch -p0 < ../layout.patch.
Notice that the switch -p0 tells patch to
strip off 0 (zero) directory names from the paths in the patch file,
and the rest simply gives patch input from the file.
-
You should see output like
patching file src/edu/ucsd/cse70/ircclient/IRCClientWindow.java.
-
Now try
svn status and
svn diff
to see the changes that have been made to your working copy.
-
Now run
svn revert src/edu/ucsd/cse70/ircclient/IRCClientWindow.java
and check again to see the changes have been reverted, so we can ...
Apply the patch using Eclipse.
-
In your Eclipse package browser, right-click on your project root,
select
Team->Apply Patch..., and
specify the patch file you saved earlier.
-
At the "Review Patch" step you may need to adjust the
"Ignore leading path name segments" or "Maximum fuzz factor" options
(which correspond to the
-p and -F command-line
options to patch).
-
Note you can double-click the "hunks" listed under "Patch Contents"
to see a side-by-side comparison of the code before and after that change.
-
Also note you can right-click on each hunk and specify whether to
exclude or include it when applying the patch.
-
When the patch is applied, go through the routine
commit procedure,
but using "Lab 5" instead of a ticket number in your commit comment.
Notice that, in Trac, changesets
(like this one)
have links at the bottom labeled
Unified Diff.
You can apply these diffs as patches too!