Subversion

Philosophy - Create project - Client software - Play with Tortoise

Subversion is a free tool that allows you to manage files that you need to share with other people in a project, need on different locations, want to keep different versions, ... It is nowadays the standard tool for doing so.
You need to do three things:
  1. Understand Subverion's philosophy.
  2. Create a repository on a server.
  3. Install client software.
  Ready to synchronize your data!!

Subversion's philophy

Your files are stored on a server in what is called the repository. It keeps the latest version of each file (called the HEAD), but also all previous versions. You start with performing a checkout, by which you link a local folder to the repository. The files of the repository are downloaded from the server and you can work freely on this local copy.

New files are uploaded to the repository by the add command. Uploading changes to existing files is called a commit. Downloading changes to files that others have made is called an update. To verify you local copy with the version on the server is called synchronization.

Subversion makes file sharing very easy.


The only difficulty that might occur is when two persons have made changes to the same file.

Consider the following example (figure on the left) in which Sally has made a change to file A, commited this change and Harry wants to commit his changes.

This results in an out-of-date error.

Harry first has to update his file, merge Sally's changes with his. See figure on the right. Only then he might commit the merged file.

The merge of Harry's and Sally's changes can happen automatically unless both made changes to the same lines in the file. Then, Harry should manually perform the merge. This is called conflict resolution.


Create a project repository

You can freely create a repository at the following locations. You'll get a user, password and host url, which you will need later.

  Google Projects:
  Assembla:

Client Software

You'll need some software to access the server.

Install TortoiseSVN, which allows you to synchronize with the repository in Windows Explorer. (It is installed in the PC rooms of the 3rd floor).
In Eclipse, you install the subclipse plugin from http://subclipse.tigris.org/update_1.2.x (Only select subclipse).


Play with Subversion

Subversion installs itselfs in the context menu of Windows Explorer.
To Checkout a project, create a new folder, right click and choose checkout.
You will be asked for host url, user name and password.
It's wise to use an empty folder!

From then on you see a green 'v'-symbol appearing on each folder or file that is synchronized with the repository.
In the context menu you'll find the commit and update commands.
With each commit you can optionally add comment about the changes you have made.

Conflict Resolution
If you try to update but your file is not up-to-date, you get an out-of-date error.

To solve it, do a synchronize: choose TortoiseSVN => Check for Modifications and double click on the file to be merged.

In the TortoiseMerge window, you'll see at the left the version of the repository and on the right your version.
All differences are indicated. In the right version you select for each line what you want.
If you have resolved all conflicts, close the merge window after having saved your file.
Then indicate that you resolved all conflicts by choosing Resolved from the Tortoise menu.
Finally, perform a commit.

If you do an update, Subversion tries to manually merge your changes with that of the server.
For conflicts, both versions will appear in your file. Like this:
<<<<<<< .mine
* TORTOISE
=======
* == TORTOISE == *
>>>>>>> .r20
First your version is given and below that of the server.
(Note that subversion also makes a copy of your file and the server's).
Choose whatever you want, mark the file as resolved and commit.




TIP: use Windiff to compare two folders or two files