Creating and Applying Patches

From Opentaps Wiki

Jump to: navigation, search

Contents


Creating Patches

Patch of Changes that I Made

To make a patch of the changes you made to opentaps, you can use the svn diff command from a terminal or command prompt.

First, ensure you are in the root directory of opentaps,

  prompt> cd opentaps

To verify that you're in the right directory, ensure that it contains the build.xml and startofbiz.sh files. Next, execute the svn diff command,

  prompt> svn diff

It will print the patch of all changes you made to the screen. To save the output to a file instead, use a redirect,

  prompt> svn diff > mychanges.patch

This command will create a mychanges.patch file that contains all changes you made to opentaps.

If you wish to see changes of only one file or directory, you can specify the file or directory explicitly,

  prompt> svn diff applications/product

This command will make a patch of all your changes to the applications/product/ directory and its children.

Patch of Specific Revision of Opentaps

Let's say you want to create a patch against a specific revision of opentaps, such as the bugfix revision 9593. In order to do this, you will need either a complete checkout of opentaps that's fully up to date or internet access to the opentaps subversion repository. Since it's simpler to use the online opentaps subversion repository, we will go over this technique here.

To make the patch, use the svn diff command and use the -c argument to specify the revision. You must also specify the location of the opentaps repository from the trunk directory. The full command is as follows,

  prompt> svn diff -c 9593 svn://svn.opentaps.org/opentaps/versions/1.0/trunk > bugfix.patch

A file named bugfix.patch is created and it contains revision 9593 of opentaps.

Applying Patches

If you get a patch, you can use it to modify your files with the patch command. patch is a standard UNIX command, and a Windows version is also available. First ensure that you are in the root directory of opentaps,

  prompt> cd opentaps

It should contain the build.xml and startofbiz.sh files.

We recommend copying the patch file to this directory for convenience. For instance, if you have the bugfix.patch patch file from the above example, copy it into the opentaps root directory. Also make sure the patch is not compressed (.zip or .gz).

Next, use the patch command with -p0 arguments as follows,

  prompt> patch -p0 < bugfix.patch

If you did not copy the path file to the opentaps root directory, you will have to specify the full path to your patch file,

  prompt> patch -p0 < /path/to/bugfix.patch

Assuming you have made no major changes that would conflict with the patch, it should be applied without errors. You can check to see if the patch was applied correctly using svn diff.

Dealing with Patch Rejects

Sometimes the patch might fail to be applied to a certain file. In this case, a rejection file is created with information about what caused the problem. Rejection files have the same name and location as the file that was not patched, except that it has an extension .rej.



© Open Source Strategies, Inc. Development of this documentation site is sponsored by Open Source Strategies, Inc.
Help support opentaps with a subscription to this documentation site.