Installing subversion

From GHER

(Redirected from Install subversion)
Jump to: navigation, search

Contents

Installation of Subversion

sudo aptitude install subversion
sudo addgroup subversion
sudo adduser abarth subversion
sudo mkdir /home/svn
cd /home/svn
sudo mkdir repos
sudo chown -R www-data repos
sudo chgrp -R subversion repos
sudo chmod -R g+rws repos
sudo svnadmin create /home/svn/repos
sudo chmod -R g+rws /home/svn
sudo chgrp -R subversion /home/svn

Add a user to subversion

  • create a user account on modb which belongs to the group "subversion". From the command line:
sudo adduser aalvera
sudo adduser aalvera subversion

or using the GUI

sudo users-admin

It is advisable to use SSH keys and ssh-agent to cache your passphrase. Otherwise, Subversion will prompt you to enter your password/passphrase several times when communicating with the server. For more informations: https://help.ubuntu.com/community/SSHHowto and instructions can be found here: http://fedoranews.org/dowen/sshkeys

Typical layout of a repository

For example, your repository might look like:

/
  calc/
     trunk/
     tags/
     branches/
  calendar/
     trunk/
     tags/
     branches/
  spreadsheet/
     trunk/
     tags/
     branches/
  …


trunk
common development version
tags
contains the released versions of software. They are usually not changed afterwards
branches
parallel development branches contains usually new feature which are not yet well tested. Once the branch has stabilized it is merged into trunk.

Setting up a new project

Create a project with the following directory structure

mkdir tmpdir
cd tmpdir
mkdir -p projectA/{trunk,branches,tags}

Import this into the repository:

svn import . svn+ssh://modb.oce.ulg.ac.be/home/svn/repos --message 'Initial repository layout'

Clean-up:

cd ..
rm -rf tmpdir

Download a working copy

svn co svn+ssh://modb.oce.ulg.ac.be/home/svn/repos/projectA/trunk projectA
Checked out revision 0.

Add a file to the repository

cd projectA
cp /somewhere/hello.f90 .
svn add hello.f90
A         hello.f90
svn commit -m 'add some file'
Adding         hello.f90
Transmitting file data .
Committed revision 1.

Edit

Make some changes. Examine differences with

$ svn diff
Index: hello.f90
===================================================================
--- hello.f90   (revision 1)
+++ hello.f90   (working copy)
@@ -1,5 +1,6 @@
 program hello
  implicit none
+ integer :: i

  write(6,*) 'hello world'

Upload changes

svn commit -m 'add integer'


Don't Forget ...

... to make backups! It's possible to dump the contents of the repository (including all revisions) into a dumpfile. This format is portable, and you can use it to reconstruct a repository if necessary.

svnadmin dump /home/svn/repos | gzip -9 > svndump-$(date +%Y%m%d-%H%M).gz

This way, the repository can be restored via

gunzip -c <file>.gz | svnadmin load /home/svn/repos


Restore

gunzip -c <file>.gz | svnadmin load /home/svn/repos

More infos

Personal tools