Creating and Applying a Patch
See Also
A patch file is a file that contains the differences between source code file
versions. A patch file enables software developers who do not share
the same repository to distribute and integrate changes that
have been made to the code without requiring files to be changed by hand.
In the IDE, you can create a patch file and apply the patch
to source files so that the source files are updated with the differences
automatically.
You can create a patch of:
- The difference between a locally modified source file or a folder with locally
modified source files in your working directory and the revision in the repository
by using the CVS
Diff Textual
command.
- The difference between two revisions of a source file or a folder of source
files in the repository by using the CVS
Patch
command. The Patch command is not supported in the built-in CVS client.
To create a patch file of the differences between a locally modified
source file or folder of source files in your working
directory and a revision in the repository:
- In the Filesystem window, right-click the locally modified file or folder and
choose CVS
Diff Textual.
- In the Diff dialog box, identify the revision numbers or dates of
the revisions you want to compare.
If you want to compare your working copy with the revision
in the repository upon which your working copy is based,
click OK without entering any data.
If you want to compare your working copy with any other
revision in the repository,
type the revision or tag in the Revision or Tag text field or
click Select to select a revision or tag from a chooser.
The HEAD revision is the latest revision that has been
committed to the repository.
Then click OK.
- In the Output dialog, ensure that the output shows the correct
differences.
- Right-click in the output pane and choose Save To File
from the contextual menu.
To create a patch file of the differences between two revisions
of a source file or two revisions of a folder of source files in the
repository:
- In the Filesystem window, right-click the source file or folder and choose
CVS
Patch
from the contextual menu.
The CVS
Patch command runs on file versions in the repository,
not on files in your local working directory.
-
In the Patch dialog box, identify the revisions you want
to compare and describe the style of the diff output.
Choose from
the following settings:
- Context Format. The output shows each difference
surrounded by two lines of contextual text.
- Unidiff Format. The output shows line numbers
of every difference surrounded
by a pair of at-signs (@@). Lines where text has been added
are marked with a plus sign (+) and lines where text has been
deleted are marked with a minus sign (-).
- Short Patch. The output shows every difference
as one line only.
- Top Two Diffs. The diff is between
the two latest revisions of the file or folder.
- Revision or Tag. The revision number or tag of the
first version of the file or folder to use to create the diff output.
For a file (not a folder),
click Select to select the desired revision or tag in a chooser.
- Date. The timestamp of the first version of the file
or folder to use to create the diff.
- The HEAD Revision. The latest revision of the file or
folder committed to the repository.
- Revision or Tag 2. The revision number or tag of the
second version of the file or folder to use to create the diff
output. For a file (not a folder), click Select
to select the desired revision or tag in a chooser.
- Date 2. The timestamp of the second version of the file or
folder to use to create the diff.
- Click OK.
- In the Output dialog, ensure that the output shows the correct
differences.
- Right-click in the output and choose Save To File
from the contextual menu.
To apply the patch to a file or a folder:
- Right-click the file or folder and choose
Tools
Apply Patch.
For a folder, the patch file must be applied on the same folder node where
the patch was created because the patch file contains the relative
paths to the files in the folder so that the IDE can apply
the patch properly.
- Type the path or navigate to the patch file you want to apply to the file
or folder.
- Click Patch.
- Verify that the file or folder contains the changes from the patch file.
Legal Notices