TortoiseSVN is a free and open-source Subversion client for Microsoft Windows. It is not tied to any particular Integrated Development Environment (IDE); instead, it is a shell extension which integrates into the Windows Explorer, giving you easy access to Subversion repositories from within applications you're already familiar with. This means that it can be used with any software, and by all members of your development team.
In this chapter, you will learn how to set up TortoiseSVN, and how to set up a Subversion server to use it with. You will also learn a little bit about the TortoiseSVN user interface, so that you have an idea of the basic options provided by the software. Later chapters will explore each of those options in detail.
In this chapter, we shall:
Install TortoiseSVN
Create a repository
Install SVNserve â a simple, easy-to-set-up Subversion server
Install Apache + Subversion â a more flexible Subversion server
So let's get on with it...
The first thing you need to do is choose the right version of TortoiseSVN for your computer. TortoiseSVN is available in two versions, one for 32-bit versions of Windows, and one for 64-bit versions of Windows. The 32-bit version can be used on both 32 and 64 bit versions of Windows, allowing you to use Subversion with older 32-bit applications on more modern operating systems, while the 64-bit version will work on 64-bit versions of Windows only.
You may already know which version you need, in which case, you can skip this section and go straight on to Installing TortoiseSVN. However if you aren't sure what flavor of Windows your computer is running, follow the below instructions to identify which version you need.
If you aren't sure whether you're running a 64-bit or 32-bit version of Windows, you can check quite easily. If you didn't install the operating system yourself, it's a good idea to double check. Remember that it's possible to run a 32-bit operating system on a 64-bit processor and it's not uncommon for department stores to sell pre-built computers with a 32-bit operating system, even if the processor powering the computer is a 64-bit one.
To check the architecture of a Windows Vista or Windows 7 computer, follow these steps:
Click the Start button.
Click inside the Start Search box.
Type
msinfo32.exe
and then press the Enter key.A System Information window should appear. Look in the right-hand pane for System Type. If you have a 32-bit version of Windows, the System Type will be x86-based PC. If you have a 64-bit version of Windows, the System Type will be x64-based PC.
To check the architecture of a Windows XP computer, follow these steps:
Click the Start button.
Click Run...
In the box that appears, type
winmsd.exe
and then hit the Enter key.A System Information window should appear. Look in the right-hand pane for System Type. If you have a 32-bit version of Windows, the System Type will be x86-based PC. If you have a 64-bit version of Windows, the System Type will be x64-based PC.
To check the architecture of a Windows Server 2003 based computer, follow these steps:
Click the Start button.
Click Run.
In the box that appears, type
sysadm.cpl
and then press the Enter key.On the General tab of the window that appears, you should see Microsoft(R) Windows (R) Server 2003, Enterprise Edition if you are running the 32-bit edition. If you are running the 64-bit edition, you will see Microsoft(R) Windows (R) Server 2003 Enterprise x64 Edition.
You have just identified the architecture of the version of Windows that is installed on your computer. It is important to know whether you are running a 32-bit or 64-bit operating system so that we can install the correct version of TortoiseSVN.
If you have a 32-bit version of Windows, you should install the 32-bit version of TortoiseSVN. If you have a 64-bit version of Windows, you can install both the 32-bit and 64-bit versions of TortoiseSVN side-by-side. Doing this will enable TortoiseSVN's features for both 32-bit and 64-bit applications.
Tip
Why is 32-bit called x86?
You may be wondering why 64-bit is called x64
, but 32-bit is called x86
. The reason is part of the history of computing. x86
is a CPU instruction set which is used in most modern processors. There are three subsets of the x86
instruction set â x86-16
(16 bit), x86-32
(32-bit), and x86-64
(64-bit). The 32-bit version of the x86
instruction set was first used in the 80386 processor, and quickly became an industry standard.
The term x86
really refers to backwards compatibility with the original 8086 instruction set, but the popularity of the x86-32
subset means that most people use the term x86
to refer to a modern 32-bit processor.
Go to http://www.Tortoisesvn.net, and click the Download link in the sidebar at the left-hand side of the screen.
If you have a 32-bit version of Windows, download the 32 Bit version of the installer. Users of 64-bit windows can download both the 32 Bit and the 64 Bit versions, although in most cases only the 64-bit version will be required. The 32-bit version is needed only if you want TortoiseSVN to work with legacy applications.
Once the download completes, right-click on the
.msi
file, select Properties, navigate to the Digital Signatures tab and confirm that the signature is present. It should look something like the following screenshot:Next, double-click on the install file to run it.
Depending on the version of Windows you have, you may see a security warning similar to the one shown in the next screenshot. If the warning appears, click Run to dismiss it and continue with the installation.
When the installer welcome screen appears, click Next.
Read the license agreement. If you agree to the terms, select I accept the terms of the License Agreement and click Next.
In most cases, the default options presented on the Custom Setup screen will be acceptable. If you do not want the additional icons, or one of the dictionaries, you can remove them by clicking on the down arrow next to the relevant option, and then clicking the red cross next to Entire feature will be unavailable. I recommend you leave Register diff/patch files checked, as this will ensure that TortoiseUDiff is set as the default for opening
.diff
and.patch
files. Once you are happy with the list of features, click Next.Next, click Install.
Depending on the speed of your computer, the installation may take a few minutes. When it completes, you should see a window similar to the one shown in the following screenshot:
After clicking Finish, you will be prompted to reboot. Click Yes if you are ready to reboot, or click No if you need to save some work or close some applications before rebooting. Make sure you do reboot before using TortoiseSVN.
We have just installed TortoiseSVN. Remember that if you have a 64-bit version of Windows, you can use both the 32-bit and 64-bit versions side-by-side if required. So, if you have just installed the 32-bit version, don't forget to install the 64-bit version. The installation process is the same for both versions. In most cases, users of 64-bit versions of Windows will be fine with the 64-bit version of TortoiseSVN. However, if you find that some of your older applications lack the context menu functionality of TortoiseSVN, then it's likely that they are 32-bit applications, and therefore need the 32-bit version of TortoiseSVN to be installed.
The effects of the installation may not be obvious. The most obvious change is that you now have some new right-click options â try right-clicking on a text file on your hard drive to see the options that TortoiseSVN has added. We will be exploring a few of these options later on in this chapter. The new right-click options are shown in the following screenshot:

The right-click menu is context sensitive â right-clicking a folder, for example, will give different options to right-clicking a file. Right-clicking on a shortcut, or multiple files at once, will also give different options. We will explore these in greater depth later.
TortoiseSVN has been translated into several different languages. You can see a list of the available language packs at: http://tortoisesvn.net/downloads.
The language packs are offered as executable installers. Simply download the ones you need, double-click the file to execute it, and follow the on-screen instructions.
TortoiseSVN also comes with a spellchecking feature, which allows you to check the spelling of commit log messages. The installer automatically sets up the British English and American English language files, however some people may need to spell check using different languages âfor example, Australian English differs slightly from British English and American English.
Download the dictionary of your choice (for example, English (Australian)) from http://wiki.services.openoffice.org/wiki/Dictionaries.
Extract the
.zip
file, and look at the file names â they should match the standard formatting oflanguage_COUNTRY
â for exampleen_AU.aff
anden_AU.dic
â if there are extra characters or words in the file name, remove them.
Copy the files to the /bin/
folder inside your TortoiseSVN installation. Restart TortoiseSVN â your dictionary should be available for use.
You have installed an extra dictionary for spell-checking purposes. When you install a new language, the spell-checking functionality for that language is installed alongside it. However, it is possible to install spell-check dictionaries separately. This is useful for people who live in a country, who speak a dialect not covered by the standard TortoiseSVN language files.
Now, when you go to submit a changelog, spell-checking will be enabled.
If you have more than one dictionary installed, you can select the one you want to use via the Project Language option in the Project Settings menu â we will explore those options in more detail later.
Now that you have our client installed, you can make a repository. This is where the master copy of the code that we are working on (and any previous versions of the code) will be stored. You can then import code into the repository. Before we make any changes to the code, we will have to create a "working copy" of the code â this is useful because it helps if something goes wrong and a developer breaks the "working copy", there will still be a functional copy in the repository, which the developer can re-download.
Create a new folder on your C:\ drive. If you're using Windows XP, create the folder in
C:\svn_repository
. Users of Windows Vista or 7 should create the folder under theiruser
folder.Navigate to that folder, right-click inside it, and then from the TortoiseSVN menu, select Create repository here.
After a couple of seconds, you should see a message saying that the repository was successfully created, and several files and folders should appear inside the
repository
folder.Congratulations, you've made your first repository!
You've just set up a repository. This is a central location where the code for your software projects is stored. In Chapter 2, Getting Started With TortoiseSVN, you will learn how to check out code from this repository, so that you can work on it â uploading your changes once you are done. The copy that you have checked out is called the "Working Copy" because it is the copy you are directly working on â not because of the status of the code!
The repository will keep track of each version, so if you make a change today and then decide later on that the change was a bad idea, you can roll back to a version of the code that existed before you made the undesired change.
Before we explore those features, it's a good idea to organize the repository so that it's easy to work with in the future.
There are a couple of different ways of organizing a repository. If you're planning on having only one project in the repository, you can get away with creating three top-level directories to handle branches, tags, and the trunk.
If you will be hosting more than one project within your repository, then you should create a folder for each project, and then put the branches
, tags
, and trunk
folders in there, shown as follows:
MooseHirigana /branches /tags /trunk Project2 /branches /tags /trunk Project3 /branches /tags /trunk
The above layout is just an example. Subversion itself does not care what layout you use. If you have a different idea for the folder layout, then you can use that. The most important thing is that the layout is consistently enforced, and understood by all the members of your team.
Create your chosen folder structure in a temporary folder on your hard drive, then right-click on the folder and select TortoiseSVN | Import to import the structure to your new repository.
Now let's set up a Subversion server so that other members of the team at Shiny Moose Software can take advantage of the features that Subversion offers.
Now that you've made your repository, it's time to check that you can access it.
Create a new folder that you will use to as your working area while you are developing your application. You can place the folder anywhere you wish. For ease of access, I placed it on my desktop.
Right-click inside that folder, and select SVN checkout.
Click on the ... button next to the URL of repository option, and browse to the path of your repository.
Notice that the local path is formatted like this:
file:///C:/svn_repository/MooseHiragana
- the UNIX-style slashes, and thefile:///
notation is important â Windows-style slashes won't work.Click OK.
View the working folder again; you should see a Hiragana folder inside it. The folder icon should have a small green tick. The tick means that the copy's status is "Normal".
To make full use of your Subversion client, you need a Subversion server. It is possible to run the client and the server on the same machine, although for larger development teams, a stand-alone server will offer better performance.
The simplest way to set up a Subversion server is to use SVNServe. This method generally provides good performance too. I recommend that you use an SVNServe-based server unless you require some of the more advanced features offered by an Apache and Subversion-based server.
Download the CollabNet Subversion Server and client for Windows from http://www.collab.net/downloads/subversion - you will need to create an account to do this, but don't worry, registration on CollabNet is free, and they won't share your e-mail address with anyone.
Run the installer, and follow the on-screen instructions. As we want SVNServe only, deselect the Apache(MOD_DAV_SVN) option and click Next.
Ensure that the Install svnserve to run as a Windows service option is checked. For most people, the default Port is OK. Choose a Repository Path which matches the path you created for your repositories in the previous "Time For Action". In the case of Shiny Moose Software, the default path is correct.
In most cases, the options on the Automatic Updates screen can be left at the defaults. If you use a proxy to connect to the internet (which is unlikely, unless you are installing the server in an office environment), then tick the relevant box, and fill out the proxy details when prompted.
Finally, click Finish.
We have just set up a simple SVNServe-based Subversion server. At the moment, we can't do much with the server. It allows anonymous read access, but no write access. That means it's great for letting people download our code, but not so useful for letting people submit any changes they decide to make.
We could allow anonymous write access â but that wouldn't really be a good idea â after all, what's to stop a competitor, or simply a mean-spirited person, from changing our code? Also, how will you know which member of your team submitted which changes? Giving each user of your repository a username makes it a lot easier to track who is doing what, and also to restrict what each person can do. Instead of allowing anonymous write access, let's set up some simple authentication, so that we can control who can and cannot edit our code.
Navigate to the
/conf/ folder
in your repository, and opensvnserve.conf
.Paste the following lines underneath the line that says [general].
anon-access = none auth-access = write password-db = users
Save the file, and create a new file called
users
(with no extension) in the same folder.Drag the
users
file over a Notepad window to edit it, and enter the following text (where AUSERNAME is any username and APASSWORD is the password you want that user to have:[users] AUSERNAME = APASSWORD
You have set up your Subversion server so that unauthenticated users cannot access the server, and authenticated users can read from and write to the server.
The code we added to the config
file in step 2 tells SVNserve that anonymous access is not permitted, and that authorized users (those listed in the users file) should have write access to the repository.
Now that you know how to make a repository, and how to set up some security, why not try making a new repository, and using different login details for it. Imagine that Shiny Moose Software decides to produce a second game called GermanMoose â they want to give the same people who are working on the Hiragana game access to the GermanMoose repository, but they also want to give a new employee, called Dieter, access to that repository so that he can work on translations.
Create a new repository, and make a copy of the users file, with a username and password for Dieter added to it. Check that you can access the folder with the right permissions.
An Apache and Subversion-based server is a more flexible (and more complicated) Subversion solution. It is up to you whether you choose to use this setup. If you are happy with the functionality and performance of a SVNserve-based setup, then it would be wise to use that instead.
An Apache and Subversion-based setup is useful if you want to allow users to browse your repository via a web browser, or if you want to use SSL encryption for extra security. Another benefit of Apache and Subversion is that your server can use any authentication method that Apache supports.
If you do not need any of those features, then you may prefer SVNserve as it is easier to deploy and manage, and also performs slightly faster in most cases. By far the easiest way to set up an Apache server on Windows is to use VisualSVN, a combined installer for Apache, VisualSVN, and an administrative panel.
Download VisualSVN from http://www.visualsvn.com/server/download.
Run the installer, and click Next when prompted.
Set the path for your repository. Windows XP users can accept the defaults. Windows Vista and Windows 7 users may need to change the repository folder path to one inside their user directory.
Once the installation is done, you should see a window which looks like the following screenshot:
You can create a new repository by going to Action | Create New Repository, and entering the name of the repository there.
You have just installed VisualSVN. This offers an easy-to-use management console, and gives you a working Subversion server right out of the box. The default setup is ready-to-go, but there are some extra features you will want to look at if you're using the server in a production environment.
You will find a full guide to the more advanced features of VisualSVN, such as SSL, at http://www.visualsvn.com/server/getting-started/.
VisualSVN is the quickest and easiest way to get a working Subversion server. This method is the best choice for most people.
For the sake of completeness, the following instructions explain how to set up Apache and Subversion separately. If you are using VisualSVN, you can skip the rest of the sections in this chapter.
Download Apache from: http://httpd.apache.org/download.cgi. I recommend you choose the newest stable binary installer that includes OpenSSL. You will find the Windows installers under Other Files | Binaries | Win32.
Run the installer, and follow the on-screen instructions.
For the Server Information, enter a descriptive Network Domain and Server Name. If you will be using Subversion on your local network, I recommend you use a domain name ending in
.local
. If you want your server to be accessible over the internet, you will need to use a valid domain.Leave the radio button that says for All Users, on Port 80, as a Service -- Recommended selected, as shown in the following screenshot:
On the next screen, choose Typical install, then click Next.
Select a path to install Apache to (for most people, the default will be fine), then click Next.
Depending on the speed of your computer, the installation process may take several minutes.
To confirm that Apache is installed correctly, open your web browser and go to
http://localhost
, you should see a screen containing a message saying It works!, as follows:
You have successfully installed the Apache web server for Windows. The It works! page you viewed in your web browser may not look impressive, but is a simple HTML web page!
The Apache server will be used by Subversion to allow users to access your repositories over the network (or the internet, if you choose to set your firewall up to allow that) using a web browser.
Download Subversion from http://subversion.tigris.org/servlets/ProjectDocumentList?folderID=8100 â make sure you select the correct version of Subversion for your Apache installation.
Install Subversion, and follow the on-screen instructions.
If Subversion detected Apache, skip to step nine. If it did not, follow steps 4-8.
Go to
c:\Program Files\Subversion
, and open the\httpd
folder. Copymod_dav_svn.so
andmod_authz_svn.so
toc:\Program Files\Apache Group\apache2\modules
Go to
c:\Program Files\Subversion\bin
and copylibdb44.dll
andint13_svn.dll
from that folder to Apache's\bin
directory.Open Apache's
httpd.conf
file in Notepad, or your favorite programmer's text editor. You can find the file atc:\Program Files\Apache Group\Apache2\conf\
Uncomment the following two lines by removing the
#
sign at the beginning of them:#LoadModule dav_fs_module modules/mod_dav_fs.so #LoadModule dav_module modules/mod_dav.so
By uncommenting the preceding lines, we are telling Apache to load the
mod_dav
modules.Add the following two lines to the end of the LoadModule section in
http.conf
:LoadModule dav_svn_module modules/mod_dav_svn.so LoadModule authz_svn_module modules/mod_authz_svn.so
Open
httpd.conf
, and at the end of the file, add the following:<Location /svn> DAV svn SVNListParentPath on SVNParentPath c:\svn_repository AuthType Basic AuthName "Subversion repositories" AuthUserFile passwd Require valid-user </Location>
The preceding code tells apache to use Basic Auth security on the
/svn
folder, and tells it where to find the file containing the usernames and passwords. Basic Auth is a simple form of security where a user is prompted by their browser for a username and password when they navigate to a protected folder. Basic Auth is not encrypted, so is not suitable for protecting areas which contain sensitive data.Finally, open a command prompt (Start | Run | CMD), navigate to the
c:\Program Files\Apache Group\Apache2.2
folder, and enter:bin\htpasswd âc passwd USERNAME
Where
USERNAME
is the user ID you plan to use to access the Subversion server.When prompted, enter a password for that user.
Now you should be able to access your Subversion server by navigating to
http://localhost/svn
in your web browser â enter the username and password when prompted:
You have just created a basic example of an Apache + Subversion server. From here you can add extra security with SASL Authentication and Encryption.
An Apache + Subversion server setup is useful for developers who want more robust authentication, and the ability to allow access to their repository via the web.
The basic authentication should be sufficient for an internal server. You can have as many users as you want. Each employee at Shiny Moose Software has their own login details, which makes it easy for the lead developer to see who is working on which part of the program, and what changes they have made.
The 32-bit version of TortoiseSNV
a. Comes on 32 floppy discs.
b. Is used on 32-bit Windows and on 64-bit Windows by 32-bit applications.
c. Is able to handle only 32 repositories at once.
A "working copy"
a. Is a copy of the source code that still works.
b. Is an illegal copy of your source code that is being downloaded by software pirates.
c. Is the copy that you have checked out of the repository.
Apache and Subversion
a. Is used by people who prefer Apaches to Tortoises.
b. Is more flexible and offers more security options, but is harder to set up than SVNserve.
c. Is easy to set up, but offers fewer options than SVNserve.
This chapter focused on setting up TortoiseSVN and a Subversion server for it to be used with.
Specifically, we covered:
Identifying which TortoiseSVN version you need â the 32-bit version is designed for 32-bit Windows installs, and also works with 32-bit applications on 64-bit Windows installs. The 64-bit version can only be used on 64-bit Windows installs, and with 64-bit applications.
Installing TortoiseSVN.
Installing SVNserve â an easy-to-install and effective Subversion server, this runs as a Windows Service.
Installing Apache and Subversion â a more sophisticated way to run a Subversion server.
We also touched on securing your server â we will explore that in more detail in Chapter 9, Using SSH With TortoiseSVN.
So far, you have installed TortoiseSVN and used it to create a repository. You have also set up a server, so that each member of your team can access the repository. You may be wondering when you will get to see TortoiseSVN in action â well, the good news is that you don't have to wait any longer â Chapter 2, Getting Started With TortoiseSVN will give you your first taste of using TortoiseSVN â you will learn how to use the repository browser, check out a Working Copy, and commit any changes you made to the copy.