Creating Patches, Viewing Differences and Applying Patches to Your Working Folder
Even if you don't have a CVS account for any given project, this does not restrict your ability to contribute to it. You can create patches against the repository. A patch is the difference between two files or group of files in a standard format that allows someone else to apply it to his working folder and get your modifications in his files.
Remember to give a name for the patch that express the changes and the name of the original files. Suppose you proofed a text file in the repository. A good file name for the patch is file_name-proofread.diff, where file_name is the name of the original file. (It is also standard procedure to proof the text you modified and test the modifications before you send them in the form of a patch).
Currently, one difference file is generated for all modifications in the working folder, recursively. This means you create a single patch for all your the changes against the repository.
- Open the sandbox (working directory) where the modifications are located.
- Click the "Advanced Menu", and then the "Create patch Against the Repository" menu item.
- KDE's File Dialog will pop up. Type the name of the patch file you will create, (for instance, press OK, and you created the patch!..
Cervisia's built in difference viewer is user friendly and complete, making viewing your changes a breeze.
- Open the sandbox (working directory) where the files are located.
- In Cervisia's Main Window, select the modified file.
- Click the "View Menu", and then the "View Difference to repository (BASE)" menu item. (You can also right click the file to access this menu item).
- Cervisia's difference viewer will pop up, enabling you to browse the differences. You can easily go forward to the next difference and backwards, by scrolling down and up or pressing the "<<" or ">>" buttons.
You can also apply patches to your working folder Suppose you reported a bug. The developer may post a patch and ask you to test it to see if it solves your problems. You will have to apply the patch and recompile the application in order to test it. To apply the patch to a file or group of files, you can use the "patch" command line utility, that is part of the GNU Diffutils. To make sure the patch command will succeed, please apply the patch to the correct target, being a folder (and all subfolders and files) or a file. If you are not sure which is the target, open the patch file in any text editor, and look in the beginning of the file. The Kompare program in the kdesdk module also shows the patch target.
# To apply a patch, first move to the folder that contains the target file. cd path/to/target/folder patch <path_file
The patch command output will tell you if the merge was successful. For more information about the patch command, please type in a console application man patch or info patch.