Version Control/Subversion

The design of Subversion is based on CVS:

Walk Through: Installing Subversion and Subversion Tools

 * Download the msi svn-1.4.6-setup.exe
 * Run the msi

Subversion is made up of several components. Here we'll check the installation of the three components:


 * svn
 * svnadmin
 * svnlook


 * Open a command prompt.

Walk Through: Setting Up a Repository
The svnadmin create command is used to create a repository. To make the distiniction clear between client or server in this example we will create two directories server and client. Administration of repositories in the examples is carried out in the server directory whilst client side work is carried out in the client directory.

svnadmin create repos
This section looks at creating a repository. In the day to day use of subversion this is a task you will only carry out infreqequently. For trying out new ideas it is useful to know how to set up a simple repository. To create a repository you need to use the svnadmin command.

Start by creating the server directory and change into this directory.

Create a repository in the repos directory.

We can now look at the standard directory structure for a repository.

svnlook
svnlook is part of the subversion utilities. It provides a way of looking at a repository without changing anything about the repository.

This shows that the repository is at revision 0, i.e. no commits have happened yet.

Adding Files to a Subversion Repository
If you have an existing file system that you want to add to version control there are several ways of doing this.


 * Use svn import
 * Create a versioned directory and then commit this.

svn import
svn import can be used to import an unversioned directory into subversion. The directory remains unversioned following the import. To work on a versioned copy of the directory it needs to be checked out from the repository.

A standard way of setting a up a project in subversion is to use the following structure:

We'll follow this structure here. First we create a temporary directory to import.

We now import this structure into the repository. It is good practice to supply a message with each change to the repositiry using the -m option. In many repositories the need to supply a commit message is enforced by the server.

We won't be using svnlook much during these walk throughs but the following shows the use of the svnlook youngest command. This is a server side command.

Now that we've imported the temp directory we delete it.

Working with Windows
We will now check out the trunk from the repository and start working on this.

You can now check out the trunk from the repsitory into yur client working area.

It can be seen that there is a .svn directory in the <tt>trunk</tt> directory.

Next we move into the client trunk directory. Look at the status of the directory and then look at a more detailed status of the directory.

You can find out where the directory is versioned using the <tt>svn info</tt> command.

We now continue with the menu example. Open Notepad and create the file "menu.txt".

Checking the status now shows that the menu.txt is an unknown file to subversion.

Walk Through: Setting Up Subversion and TortoiseSVN
This walk through will show you how to set up subversion as a set of command line applications and also how to set up the TortoiseSVN client.

Walk Through: Multiple Workers and Conflicts
This walk through will walk you through a single user and then two users using a repository. It will show you how and where different versions of files and directories change. It goes onto show you how conflicts occur and then how to resolve them.

Prerequisites
You will need the following installed to run this walk through:

svn - subversion client TortoiseSvn (Optional)

Overview
This walk through will go through the following steps:


 * Create a new repository.
 * Sam (User 1) gets a working copy and commits a few changes.
 * Pat (User 2) gets a working copy.
 * Sam makes a change and commits.
 * Pat makes a change and commits.
 * Pat makes a few changes and commits.
 * Sam updates his out of date working copy.
 * Sam and Pat make some changes and end up with Pat in conflict.
 * Pat resolves her conflict.

During the walk through you can look at the changes both using the svn command line tool and using TortoiseSVN.

Walk Through: Subversion Administration
This walk through is mainly intended for subversion administrators. This walk through will show you how to create a local repository and access it using the file:// schema. The same method is used to create full blown repository but they are configured to be accessed using different schema such as svn:// and http:// etc.