by Nikolai Shokhirev
Up: Programming | Next: Repository backup and restore
There are many excellent books and tutorials on Subversion (SVN) and TortoiseSVN. Some of them are presented in the References section. This tutorial in no way substitutes them. It covers a limited subset of subversion functionality. However, I hope that it simplifies familiarization with SVN.
Subversion is a multi-platform open source version control system (http://subversion.tigris.org/). It consists of a repository database (FSFS or BDB) and several command-line tools. There are GUI front-ends for the Subversion.
The Subversion is designed for project management with several participants. However it can be used to manage personal projects as well.
The current tutorial is limited to a Windows-based local (without a server) SVN.
Go to the download section of Tigris.org, Open Source Software Engineering Tools
( http://subversion.tigris.org/ ).
The latest command-line binaries and libraries for Windows can be found at this
At this point you can start using SVN. It is not necessary to install any GUI program if you are comfortable with using command-line tools.
TortoiseSVN is a Subversion client, implemented as a windows shell extension, a plug-in to Windows Explorer (http://tortoisesvn.tigris.org/).
The latest version can be downloaded at http://tortoisesvn.sourceforge.net/downloads. For my 32-bit processor I used 32 Bit TortoiseSVN-184.108.40.20604-svn-1.3.2.msi Installer. There is another file, TortoiseSVN-220.127.116.1104-svn-1.3.2.md5 in the download area, which is not required for installation. It contains a checksum of the installer file which is useful if you want to verify that you have downloaded the right installer (and that its not corrupted).
You can download my program HashFile (http://www.shokhirev.com/nikolai/programs/progmisc.html) and verify the installer by checking its MD5 hash (checksum). The checksum must be identical to that found in the TortoiseSVN-18.104.22.16804-svn-1.3.2.md5 file.
This installation is also straightforward, just accept the defaults. The only point of interest is the ASP.Net hack. By default, SVN uses the .svn working directories (Linux style for hidden files).
Default, without the ASP.Net hack
With ASP.Net hack for VS.Net web projects
This confuses Microsoft ASP.Net and the hack forces SVN to use the _svn working directories instead. Do not install this feature if you are not going to control your ASP.Net projects by Subversion.
Note, that after installation your Windows Explorer has extra buttons in the main menu
and in context (activated by right-clicking) menus.
There are various ways of Subversion management (see the manuals). Now we consider the most typical scenario:
In this case you should not worry about security and setting up a server.
Suppose your project resides in C:\Projects\MyProject. It contains files and possibly subdirectories:
Step 0 (Optional). Global ignore pattern setting. You probably do not want to keep track of temporary and some other types of files. Right-click on any folder, and launch TortoiseSVN/Settings:
Alternatively you can click on File/TortoiseSVN/Settings in the Windows Explorer main menu.
In the General section you can list all ignore file types separated by spaces
*.bak *.~* in the above example). Note that this setting affects all
working directories. See the section 5.25 of the User
Guide for more options.
Step 1. Repository creation. On your hard drive create the directory for repositories of all your projects, e.g. C:\SVN. Create inside it a sub-directory \MyProject. Right-click on MyProject and choose TortoiseSVN/Create repository here:
Select the default Native FileSystem (FSFS) option and click the OK button:
This converts C:\SVN\MyProject into a repository with the following contents:
So far this is an empty repository, even though Subversion has created several directories and files! We need to fill it with our project files and connect it with our working project directory. All this required several, sometimes counter-intuitive actions.
Step 2. Initial import. Somewhere in your hard drive (e.g. in C:\tmp) create a directory (e.g. \new) with the following three subdirectories:
C:\tmp\new\branches C:\tmp\new\tags C:\tmp\new\trunk
The resulting structure is:
This structure is necessary for more advanced project management, but it does not hurt to create it beforehand. Some tutorials first recommend to import this structure into the repository and later add the project. I recommend the following shortcut.
Selelect URL as file:///C:/SVN/Myproject (forward slashes!):
The "Import finished" message shows C:\tmp\new\* :
Do not worry about the "tmp\new" messages, just check what was actually imported into the repository. Right-click on C:\SVN\MyProject and start TortoiseSVN/Repo-browser:
Navigate to file///C:/SVN/MyProject/trunk:
Note that the files from the ignore list were not imported. Also there is no traces of 'C:\tmp\new'. It is no longer useful and it can be deleted.
Step 3. Creating a working directory. Now you have the repository with all your files and the empty C:\Projects\MyProject (remember, we moved all its contents to C:\tmp\new\trunk?). "To get your hands on blessed, completely approved, and fully loaded Subversion directory, you need to check it out from your repository" . Right-click on C:\Projects\MyProject and choose "SVN Checkout":
Set URL to file:///C:/SVN/MyProject/trunk and Checkout directory to C:\Projects\MyProject:
Press OK. Checkout has finished:
The "blessing" is reflected in the small icons on your project directory and all containing files (and subdirectories).
Such a "blessed" directory is called a working directory. Now you can start working with you project and learn more about Subversion.
Available as LiveCD and VMWare image.
Up: Programming | Next: Repository backup and restore
Please e-mail me at email@example.com
©Nikolai Shokhirev, 2004-2007