Delphi Clinic C++Builder Gate Training & Consultancy Delphi Notes Weblog Dr.Bob's Webshop
Dr.Bob's Delphi Notes Dr.Bob's Delphi Clinics Dr.Bob's Delphi Courseware Manuals
 Dr.Bob Examines... #133
See Also: Dr.Bob's Delphi Papers and Columns

Delphi XE and Subversion Integration
Subversion by CollabNet is a standard for version control and Software Configuration Management (SCM). Subversion is now integrated into the RAD Studio XE IDE, so anyone with Delphi XE can use Subversion features directly.
However, before we can use Subversion from the IDE, we should first create a repository to store the files.This can be done in two ways: either a local repository (for your own projects), or a remote repository, where multiple developers can connect to.

Local Repository
Since I do not expect all Delphi XE developers to start their own remote SVN repositories, I will start with creating a local repository first.For this, I’m using TortoiseSVN, which you can download from offering a Subversion client implemented as a Windows shell extension (so we can create repositories using Windows Explorer for example).
Once TortoiseSVN is installed, you can create a new directory on your local drive (in a location where you want to save the repositories – not the actual project files), and inside that directory use Windows Explorer to set up your repository.As an example, I’ve created a directory C:\Repositories on my local machine, right-clicked in it, and selected the TortoiseSVN | Create repository here option.

This will give you dialog that the repository has been created successfully, and will show a number of administration files in that directory. You should no longer manually add or remove files from this directory now.

The next step we need to do is obtain the URL for this local repository. Right-click again, and this time select the Repo-browser.

The repository will still be empty, but at least we can see the repository URL, which is file:///C:/Repositories We can now start Delphi XE, and use the repository URL to add an existing project to the local SVN repository.As an example, I can add my Matrix project to the local repository.So, while the project is opened, right-click on the project node in the Project Manager and select “Add to Version Control”.
In the dialog that follows, we need to specify the URL of the Repository. This is the URL we saw earlier in the repo-browser, followed by a name for the specific project.This name does not have to be the name of the Delphi project, but it must be some kind of subdirectory name that can be used.In our case, I can save the Matrix project in the repository URL file:///C:/Repositories/MatrixProject for example.

We then need to click in Import to actually add the file to the local repository. In the Subversion tab of the messages pane, you will see the files that have been added and sent to the local repository.
From this moment on, we can use the Subversion context menu of the project or individual files of the project to Commit (send local changes to the repository), Update (get the latest version from the local repository) and Browse Repository (to get an overview of the files in the local repository).
Unfortunately, there are no options to Lock or Unlock a file, which can be done using Checkout (lock) and Checkin (unlock). This feature request was added to Quality Central as QC report #87736 (feel free to vote!), and can be read in more detail on my weblog. Note that the Lock and Unlock functionality are especially important when working with remote repositories.

Remote Repository
To setup a remote SVN repository, we need some kind of SVN server, for which I’ve used the free Standard Edition of VisualSVN Server 2.1.3 that you can download from for free.The installer includes both Apache 2.2.13 and Subversion 1.6.12, so you must be careful (for port conflicts) if you already have IIS on your web server, which I do on my old Windows Server 2003 machine.

I’ve installed both the VisualSVN Server and the Management Console, which gives me all the options I need to manage the SVN repositories on the server.

As location for the repositories I’ve specified c:\Repositories – a location not shared or used by other applications. As port I had to specify a different port than the default port 443 (since that one was in use by IIS already), so I picked port 8443 to use https://
The only problem is that I had to use a so-called self-signed certificate, which means people will get a warning when they try to connect to my Delphi SVN repositories at

Finally, I did not want to use Windows authentication, but rather use Subversion authentication, which means I can define users, groups and repositories with rights for these users and groups.
Given a group “Delphi” and two users “Bob” and “Courseware”, I can define some SVN repositories, including one called “XE” with the project group and source files for the individual projects of my Delphi XE Development Essentials courseware manual.

The readers of the Delphi XE Development Essentials courseware manual will get the credentials for the Courseware user, which is able to read but not write to the material (that is only offered to user Bob).

With the projects in place, let’s now demonstrate how to open an example project from the XE repository. But first, I should demonstrate how to add a project to the repository, and especially how to add a complete project group.In this case, the project group with the AQtime project and the ProfileProject all at once.
Inside the Project Manager, I had to right-click on the Project Group itself, and select the Add to Version Control option. This may give you a warning if not all files are located in the same root directory, in which case you must make sure to save the file to the right place first.
When you get all files in the list of files to be committed, then you can specify the URL of the repository.For a local repository, this could be a file:/// URL, but now we have to use a “real” URL which is based at on my server.For the XE repository, we need to add the svn and XE part to it, and then we also need to add the name of the project or project group to ensure that these files end up in their own place in the XE repository.
In short, the full URL of the repository is for the project group of this section.
We can optionally add an Import Comment, which I’ve set to “These are the source files for the section on Delphi XE Third-Party Tools of Bob Swart's Delphi XE Development Essentials courseware manual.”

Then, I only need to click on the Import button to send all files over to the XE repository. However, we now get a dialog where the Subversion SSL Server certificate information is shown, including a question if we want to accept it:

This dialog is followed by the Subversion login dialog. Here, I can specify my username and password to get read/write access to the project, while you (the reader) later need to specify the information to get read-only access to the projects in this repository.

Finally, I will get the message to tell me the import was successful, and the local files (i.e. the working copy) are now locked.

Let’s now move to another machine, and open the repository (as a reader). On a different machine, I can start Delphi XE and do File | Open from Version Control.The dialog that follows can be used to specify the SVN URL as well as the local destination:

Unfortunately, there is no way to specify the credentials, so I’ve had to ensure on the SVN server that “Everyone” has at least read-only access to the repositories.
When all files are downloaded and added to the local destination directory, we get a question which project to open from the project group, or the project group itself.

The default choice is to open the entire project group, which is fine of course. This will open the project group with the two projects.
We can now right-click on the nodes in the Project Manager and select the Subversion options, like Commit (from the local directory to the server – not allowed, since we only have read-only access), Update (to get updates from the server), Show Log (to show the actions as well as any comments that were added, like the “These are the source files for the section on Delphi XE Third-Party Tools of Bob Swart's Delphi XE Development Essentials courseware manual.” comment), Clean, and Browse Repository (where we can see the files in the connected repository:

Note that you cannot save changes to my repository, since you can only read the files (and not write them). But you can open the projects from the repository, save them on your local disk and work with them.And whenever I post updates to these projects, you can retrieve the updates.

Other SVN Projects
Note that the Delphi XE sample projects themselves are also available on SVN. Project samples (previously called Demos) are installed by both the Delphi XE and the C++Builder XE installer.The samples are also checked into Subversion at SourceForge. You can check this location for additions or updates to the samples.
Finally, the Open Tools API integration of SVN in Delphi XE itself is also available in SourceForge.

This webpage © 2010-2011 by Bob Swart (aka Dr.Bob - All Rights Reserved.