Working with Patches


A patch file is basically a saved diff of one or more files that can then be applied to another working directory, thus recreating the changes in the second working directory. Patches are useful in the following situations:

  • When you want to let other developers preview a change before you integrate it to the repository.

  • When you want to share a change with someone who does not have access to the CVS repository.

  • When you only want to integrate a single bug fix into the repository and do not want to merge an entire branch over.

Creating a Patch

To create a patch of the differences between your local working directory and the latest repository version:

  1. Select the project, folder, or file from which you want to create the patch.

  2. Choose CVS | Export "file name" Diff Patch.

  3. Specify a name and location for the patch file and click OK.

You can also grab all of the changes to the repository that were committed in a single commit and save those changes as a patch. This is handy when you want to attach a single bug fix that you've done on a private branch to a bug report before you merge it into the trunk. To save a commit as a patch, find the commit as described in Working with Versioning Histories below, and then choose CVS | Export "file name [Search History]" Diff Patch.


Applying a Patch

When another developer applies your patch, he or she recreates the changes in the patch in his or her own working directory. The effect is the same as if you had committed your changes and the other developer had updated his or her working directory. You must apply the patch in exactly the same location in the working directory as where the patch was created from.

To apply a patch:

  1. Make sure there are no locally modified files in your working directory.

  2. If you do not know where the patch was created from, open the patch in a text editor. The second line displays the folder to which the paths are relative.

  3. Right-click the correct location and choose Tools | Apply Diff Patch.

  4. Specify the location of the patch file and choose OK.



NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
NetBeans IDE Field Guide(c) Developing Desktop, Web, Enterprise, and Mobile Applications
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 279

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net