Table of Contents
SVN Basics
Subversion (SVN) is a version control system. It is designed to be distributed, concurrent, and expandable.
Version Control with Subversion is a wonderful book to help you take the first steps into the world of Subversion. You may also ready it online.
SVN Client
To work on the CKEditor SVN, you need an SVN client software. There are two options that we recommend:
- TortoiseSVN (strongly recommended) for Microsoft Windows.
- The official SVN client, included in most Linux and BSD distributions; available for Linux, BSD, Mac OS X, and Windows.
Checkout the CKEditor Trunk
Checkout is the act of downloading the CKEditor code from our SVN server into a local folder on your computer. This folder is called a "local copy".
With TortoiseSVN
- Create an empty folder, which will be your local copy root. You may give it any name you wish, like
ckeditor
.
- Right-click the new folder and select SVN Checkout.
- In the URL field for the repository paste the following URL:
http://svn.ckeditor.com/CKEditor/trunk/
With SVN
- In the command line go to the folder where you want your local copy to reside in.
- Type the following to checkout the trunk:
svn checkout http://svn.ckeditor.com/CKEditor/trunk/ ckeditor
Your local copy will be found in the ckeditor
folder.
Updating your Local Copy
At any moment you may update your local copy to grab the code changes introduced in the repository since the checkout or the last update call.
With TortoiseSVN
- Right-click your local copy folder.
- Select SVN Update.
With SVN
- In the command line go to your local copy folder.
- Type:
svn update
Creating Patches
Suppose you are working to provide a fix for a ticket, for example ticket number 240
. The first thing to check is that your local copy is fresh, so start with updating it (see above).
Then start coding inside your local copy. You can do any kind of change. All the changes will be done locally on your computer and nothing will automatically end up in the SVN server. This means that you can safely play with the code.
Once you have completed your code and properly tested your changes you may return your changes back to the SVN, so they will be available to everybody. At that point you create a patch file to attach to the ticket.
With TortoiseSVN
- Right-click your local copy folder.
- Select Create patch.
- TortoiseSVN will list all files that have been changed. You may select the files that are relevant to the patch. Remember that each patch must be relative to a single ticket or feature. Do not mix ticket fixes or several different features.
- Click "OK" to save the patch file with the appropriate name. If the patch is supposed to fix a ticket, just use the ticket number for it, like
240.patch
.
The patch file is now ready to be attached to the ticket.
With SVN
- In the command line go to your local copy folder.
- Type the following (suppose you are creating a patch file for ticket
240
):
svn diff > 240.patch
The patch file is now ready to be attached to the ticket.
Applying Patches
Suppose you have a fresh local copy of the CKEditor trunk repository and you want to apply a patch found in one of our tickets.
With TortoiseSVN
- Right-click your local copy folder.
- Select Apply patch.
- Select the patch file. You will be presented with the "Diff" tool, so you can review all changes.
- In the "File patches" window list, right-click and select "Patch all".
With SVN
The official SVN program does not include a built-in command to apply patches. To do that, you can use the regular patch
Unix utility:
patch -p0 < patch_file
You may also find a Windows port for the patch program.