Share documents in a group by using a repository (Subversion)

By Laurent Soron

This article is designed to every person or group that want to share data between different computers and who want to keep a trace of each change. Typically, a repository is used to manage a project.

  1. Introduction
  2. References
  3. Installation Protocol
  4. SVN Clients

1. Introduction

This article is designed to every person or group that want to share data between different computers and who want to keep a trace of each change. Typically, a repository is used to manage a project.

The following article explain that a single user can have benefit of a repository: http://www.onlamp.com/pub/a/onlamp/2005/01/06/svn_homedir.html

This article will use the Linux distribution Debian for the server and Microsoft Windows for the client. We will use the open source software Subversion (SVN) as a version control system.

Note: It is assumed that the reader has sufficient knowledge with system knowledge and has full access rights on the target computer.

2. References

The official website of Subversion provides diverses documentations and informations about the project.
http://subversion.tigris.org/

The free book Version Control with Subversion is published by O’Reilly Media, and can be downloaded (HTML, PDF) from http://svnbook.red-bean.com/

http://www.logemann.org/day/archives/000099.html: Some good infos.

3. Installation Protocol

3.1. Install Subversion

First of all, we need to install the needed software.

The installation of Subversion software and its dependencies is performed by using the command
“ #apt-get install subversion“

The following software will be installed on your system:
“ db4.2-util libapr0 libneon24 libsvn0 libxml2 subversion“

The version installed depends of the configuration of your system. You can use the -t option to install a specific version of the package.
http://packages.debian.org/cgi-bin/search_packages.pl?searchon=names&version=all&exact=1&keywords=subversion

3.2. Add an user subversion

It is recommended to use a special user for the repository as the credentials (user, password) will potentially be shared between different persons.

Add a user subversion by typing

#adduser subversion

3.3. Create a test depot

The user(s) can create several depots in a repository. Commonly, the group will create one depot per project.

Login as the user subversion and create a depot named test in the home directory with the command:

$svnadmin create --fs-type fsfs /home/subversion/test

That’s it! The depot is now created, and is able to receive the files of the group.

4. SVN Clients

There is several clients as listed on the page http://subversion.tigris.org/project_links.html. Most commonly the group will want to access the data repository through a web interface (have a look at websvn – http://websvn.tigris.org/) or a client.

Note: the installation/configuration of WebSVN will not be described in this article.

On the windows platform, http://tortoisesvn.tigris.org/ is the well known product. It integrates itself with the Windows Explorer.

Download and install TortoiseSVN as any software.

4.1. Configure Tortoisesvn for access through SSH to the SVN server

Commonly, the group will prefer to secure the communication channel between the client and the server, for instance by using SSH.

TortoiseSVN comes with a ssh client TortoisePlink.exe.

To configure the ssh support in TortoiseSVN, open the windows explorer, right click on a directory and choose Tortoisesvn/settings in the contextual menu.

In the property page Network, you will find a ssh field:
Insert C:\Program Files\TortoiseSVN\bin\TortoisePlink.exe -l [subversion] -pw [password]

Replace [subversion] with the subversion user defined before, and [password] with the corresponding password.

(you can omit the -pw option if you don’t want to copy your password in clear text. TortoiseSvn will request you the password at each action)

Note: It’s a good idea to have a look at the help of TortoiseSVN (Entry Help in the contextual menu).

4.2. Importing data into a repository

After the configuration of the infrastructure, the group must now configure the hierarchy of the data in the depot.

Note: The help of Tortoisesvn Importing data into a repository is more complete than this part.

In windows explorer, create a directory MyProject_Root, a subdirectory MyProject and create 3 sub-directories under MyProject:

\MyProject_Root

\MyProject

\Trunck
\Branches
\Tags

Right click on the directory MyProject_Root and choose TortoiseSvn\Import… (import the files in the Repository)

A new Window appear with the Titel Import.
For the field URL, give the path svn+ssh://subversion@arnest.net/home/subversion/test

Example: for the user subversion server Arnest.net, you will type: svn+ssh://subversion@arnest.net/home/subversion/test

Enter a description for this revision, for example Import Directories.

The Window Import is replaced through a window SVN Import which log the actions.

The hierarchy MyProject should be imported in the repository.

You can check the creation of the hierarchy through the Repository Browser of TortoiseSVN (see the part Repository Viewer later in this article).

4.3. Retrieving data from a repository

Now that there is some data in the repository, another user could download the project structure on his own computer.

Create a directory Test_SVN, right click on it and choose TortoiseSvn\Export...

Choose the repository address in the drop down list, and click on ok to download the content of the repository.

In the example, the repository line will be svn+ssh://subversion@arnest.net/home/subversion/test and the following structure will be downloaded in the directory Test_SVN:
\Test_SVN

\MyProject

\Trunck
\Branches
\Tags

4.4. Check out / Commit

At this point, two users have the whole project content on their local computers. There is a need that each user notice the others that he is working on this branch of the project. To achieve it, he will set a lock on the directory by using the Check Out option of TortoiseSVN.

Redo the sames actions as the previous part (Retrieving data from a repository) but choose the option checkout... in the menu of TortoiseSvn. The same action happens: the content of your repository will be downloaded in the directory displayed in windows explorer (Test_SVN here).

Make some modifications (rename, add, remove some files for example), right click on the directory Test_SVN and choose the option SVN Commit…

A Window appears with the title Enter Log Message: The user has to explain the modification he has done at this moment.
A marker named ‘revision’ will be applied on this version and can be extracted at any time.

Select the files you want to synchronize with the repository (There is a select all option) and click on ok.

The window SVN Commit import the modified content to the repository and remove the lock. The others users can now download the last version of the tree.

To check the revision, use the option Log Message History.

If you have activated the option Show hidden files and folders in the windows explorer folder options, you will see a .svn hidden folder. This is where Subversion will store its configuration, do don’t delete it if you want to have a chance to synchronize your local data with the repository.

There is a lot more to explain, creating branches, merge modifications, but the group will understand the option by gaining experience. Use the Subversion book and the TortoiseSVN help for reference.

4.5. Repository Viewer

TortoiseSVN proposes a Repository Browser. Use this dialog to check the history of the file. It’s specialy useful if you want to retrieve a special version of one of your documents: right click on a file and choose the option log. The comments will help you to find out which revision you are searching for.
Check out this revision to retrieve the version of the file you want.

Note: Ce document est sous license Creative-Common by-nc-sa

Mots-clefs : , , , ,

Laisser un commentaire