From http://lena.franken.de/linux/subversion.html By Bavaria.
Edited by xpt on 2007-09-21.
Subversion is a file revision control system for developers.
Repository is the place where the versioned data lives in a database. Go to the computer where the repository lives. Be the user who is repsonsible for the repository.
$ svnadmin create /data/subversion
develop$ svn import findus4 http://svn.rosi13.de/svn/findus4
Creating a trunk-directory, initial import, checkout:
develop$ svn mkdir http://svn.rosi13.de/svn/findus4/trunk develop$ cd findus4 develop$ svn import -m "initial import" http://svn.rosi13.de/svn/findus4/trunk develop$ mv findus4 findus4.old develop$ mkdir findus4 develop$ svn checkout http://svn.rosi13.de/svn/findus4/trunk findus4 develop$ rm rf findus4.old
Checkout, getting out files from repository
svn checkout file:///data/subversion/findus4 svn checkout http://subversion.rosi13.de/subversion/test
Checkout, getting out files from repository when you are *behind a proxy-server*
So, you are behind a proxyserver and want to access the repository through this proxyserver.
Configure svn to use a proxy in the file ~/.subversion/servers which then should look like this:
[global] http-proxy-host = 127.0.0.1 http-proxy-port = 3128 http-proxy-compression = no
Configure your Squidserver to allow some commands with this line in /etc/squid.conf:
extension_methods REPORT MERGE MKACTIVITY CHECKOUT
Do you initial checkout:
svn checkout http://subversion.rosi13.de/subversion/test test
Putting changed file to repository
You don't need the place of the repository anymore, svn remembers it.
svn commit
New file in tree
svn add MyNewFile.pm (schedules file to next update) svn commit (puts diffs and this new file to repos)
Ignore files in a directory
Do
svn propedit svn:ignore .
Do
svn commit -m "ignoring this and that"
Moving projects from a common used repository to several single repositories
Dump complete subversion-repository to a file:
$ svnadmin dump /data/subversion >complete.svn.dump Create an extract from your first project: $ cat complete.svn.dump | svndumpfilter \ --drop-empty-revs \ --renumber-revs \ include project007 \ >project007.svn.dump
Create new repository:
$ svnadmin create /data/subversion/project007
Import complete history to new repository
$svnadmin load /data/subversion/project007 <project007.svn.dump
Install these package in debian-linux on your subversion-server: libsvn-notify-perl - Subversion activity notification.
% apt-get install libsvn-notify-perl
Check:
% svnnotify Missing required "--repos-path" parameter
If you get this error-message then you are ready to run this script when commiting code. To do this write a command into the shell-script post-commit, which is already there in your repository-directory:
cd /data/svn/findus/hooks/ ls -l
cat > post-commit
#!/bin/sh svnnotify --repos-path "$1" --revision "$2" \ --to one@dontcare.com,two@dontcare.com \ --reply-to responsible-for-everything@somewhere.com \ --language de
You get a mail like this after commit code:
Revision: 329 Author: horshack Date: 2006-01-31 22:27:05 +0100 (Tue, 31 Jan 2006) Log Message: ----------- this is the commit-message bla bla Modified Paths: -------------- trunk/findus_mini.ini
Your ~/.ssh/authorized_keys file has to look like this (everything must be in a single line):
command="/usr/bin/svnserve --tunnel --root=/var/svn",no-port-forwarding,no-agent-forwarding,no-X11-forwarding,no-pty ssh-dss AAAAB3N...
This makes that whatever program the user tries to run via ssh, he will always run
/usr/bin/svnserver --tunnel...
The user can only access svn-repositories in /var/svn.
When you have a repository /data/svn/findus/trunk he has to do this:
svn checkout svn+ssh://username@svn.juhei.org/data/svn/findus/trunk findus