Home

Search this site:
 

Horshack’s
very
own site

 

This is Bavaria, Germany!
You will find links to Perl,
bootdisks for system administration,
a lot of Linux,
Windows administration
and some personal belongings.
Subversion

Subversion

Subversion is a file revision control system for developers.

Create a new repository

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.
svn.rosi13.de:www-data$ svnadmin create /data/subversion

Initial import

Import to a local repository
develop$ svn import findus4 file:///data/subversion/findus4
Import to a webdav-repository
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

Other things

Checkout, getting out files from repository

svn checkout file:///data/subversion/findus4
svn checkout http://svn.rosi13.de/svn/Findus-Vertrieb-Ab-Cd 

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

Which files have changed? Are there new files?

svn status

What has changed?

svn diff

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

  • Before this do an svn commit
  • svn propedit svn:ignore .
  • Every file to be ignored in a new line
  • 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

Activate creating keywords

svn propset svn:keywords "Revision Date Id HeadURL Author" myfile.pm

Sending Mails when commiting files

Install these package in debian-linux on your subversion-server: libsvn-notify-perl - Subversion activity notification.
# apt-get install libsvn-notify-perl
# 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:
svn:~# cd /data/svn/findus/hooks/
svn:/data/svn/findus/hooks# ls -l
-rwxr-xr-x  1 www-data www-data 1489 Jan 31 22:18 post-commit
-rw-r--r--  1 www-data www-data 1390 Dec  5 19:21 post-commit.tmpl
...
post-commit looks like this:
#!/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

Restrict ssh-login to subversion only

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

Books



Last modified:
27.11.2007 13:07
Impressum
Wozu Witze ausdenken? Das Leben schreibt sie selbst:
Das haben wir jetzt 40 Jahre so gemacht, warum sollten wir das ändern?
Why inventing jokes? Real life does a better job:
We are doing it this way for 40 years, why should we change it?