Working with patches in CVS repositories

 

Patch is a piece of software meant to update, fix, or improve the program or its supporting data.

 

Patches allow sharing projects and programs without storing them in CVS repositories - it can be useful if you do not have write access to the project.

Patches can be applied to the program by a person with write access and committed to the CVS repository.

 

When working with branches of your CVS repositories, you can

§        create new patches and

§        apply patches .

 

Create a patch

 

Patches are created by means of the Create Patch wizard.

 

There are two ways to start the Create Patch wizard:

from the context menu of the Project Explorer view by selecting Team Create Patch:

 

 

 from the context menu of the Synchronize view:

 

 

To create a patch, please follow these steps.

 

Step 1

Select the modified resource that you want to include in the patch and start the Create Patch wizard as described above.

 

Step 2

Choose where to save the patch.

You can save patches to:

§      Clipboard - the patch will be saved to the clipboard (is advisable for small patches);

§      File system - the patch will be saved to the specified file in the file system (is generally preferable);

§      Workspace - the patch will be saved to the specified file in one of the existing workbench projects.

 

In the Changes pane you can preview and adjust the selected patch:

 

 

Only checked elements will be included in the patch (you can use Select All... to select all the items in the list).

 

Step 3

(optional)

In the Advanced Options window you can choose how to configure the patch ».

 

Step 4

After you press Finish, the patch is created and can be transferred the patched project.

 

 

Apply a patch

 

There are two ways to start the Apply patch wizard:

from the Project Explorer context menu by selecting Team Apply Patch:

 

 

from the toolbar of the Synchronize view:

 

 

To apply a patch from the Project Explorer view, please follow these steps.

 

Step 1

Select the resource to that the patch will be applied at and start the Create patch wizard in one of the ways described above.

 

This resource must contain the same file revisions as the line-up on which the patch was created.

 

Step 2

Specify the location where the patch is stored (refer here for the three possible options, with the 4th one - URL - meaning that the patch is located under the provided URL):

 

 

You can click Next to open the Review Patch window and see whether the patch was applied.

 

If you cannot apply the patch, you will get the corresponding message:

 

We recommend using file-based patches.

When using URL, make sure that it is valid; otherwise, you won't be able to apply it.

 

Step 3

(optional)

In the Review Patch  window, you can review the list of changes from your patch and check whether the patch can be applied ».

 

Step 4

Press Finish to apply the selected patch. Now the workspace contains all the outgoing changes for each file modified by the patch:

 

 

 

 

To apply a patch from the Synchronize view, please follow these steps.

    

Step 1

Open the Synchronize dialog as described above.

 

Step 2

Select Synchronize with Patch and press Next:

 

 

Step 3

Indicate where the patch is to be found :

 

 

You can click Next to see whether the patch was applied .

 

Step 4

Press Finish to apply the patch: