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:

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:

  1. In the Filesystem window, right-click the locally modified file or folder and choose CVS and choose Diff Textual.
  2. 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.

  3. In the Output dialog, ensure that the output shows the correct differences.
  4. 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:

  1. In the Filesystem window, right-click the source file or folder and choose CVS and choose Patch from the contextual menu.
  2. The CVS and choose  Patch command runs on file versions in the repository, not on files in your local working directory.

  3. 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:

  4. Click OK.
  5. In the Output dialog, ensure that the output shows the correct differences.
  6. Right-click in the output and choose Save To File from the contextual menu.

To apply the patch to a file or a folder:

  1. Right-click the file or folder and choose Tools and choose Apply Patch.
  2. 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.

  3. Type the path or navigate to the patch file you want to apply to the file or folder.
  4. Click Patch.
  5. Verify that the file or folder contains the changes from the patch file.
See Also
Comparing File Revisions Visually
Comparing Two Files in the IDE

Legal Notices