Create a new repository

Create a new repository

svnadmin create /usr/local/svn/jujutsu
chown -R idefix !$
chgrp -R subversion !$
chmod -R 770 !$

Creating a branch

We have a repository in the style:

branches/
tags/
trunk/

in the directoy trunk we have the head version. To create a branch for the files in trunk execute:

svn copy trunk branches/asterisk_idefix.fechner.net

Check if everything is fine with:

svn status
A  +   branches/asterisk_idefix.fechner.net

Then commit the changes to the repository:

svn commit -m "Branch for asterisk configuration at host idefix.fechner.net created"

First checkout

First checkout

svn co file:///usr/local/svn/jujutsu/trunk jujutsu
svn co svn+ssh://host/usr/local/svn/jujutsu/trunk jujutsu

Hide Whitespace Changes

Do not show white space changes

Do not use the command svn diff, use instead:

svn diff --diff-cmd diff -x -uw

If you use emacs with module psvn, add the following lines:

(require 'psvn)
(setq svn-status-default-diff-arguments '("--diff-cmd" "diff" "-x" "-wbBu"))

Import data into the new repository

Import data into the new repository

cd
mkdir jujutsu
cd !$
mkdir branches
mkdir tags
mkdir trunk
svn import . file:///usr/local/svn/jujutsu -m "Initial import"
cd ..
rm -R jujutsu

Move Repository to another Computer

Make a dump of the current backup:

svnadmin dump path >svn_dump_path

Copy the file to your new computer and do the following there:

svnadmin create newrepository
svnadmin load newrepository < svn_dump_path

Permanent File Removal

Filter Files/Path from Existing Repo

Dump your repo with:

svnadmin dump /path/to/repo > reponame.svndump

Now you can remove files or a complete path with:

cat reponame.svndump | svndumpfilter exclude --drop-empty-revs --renumber-revs \
/trunk/file-to-exclude.txt /trunk/path-to-exclude > reponame2.svndump

Now create you new repo and load the dump into it:

svnadmin create /path/to/new/repo
svnadmin load /path/to/new/repo < reponame2.svndump

Send Commit Mails

At first search the path for the mailer.py on FreeBSD it is:

/usr/local/share/subversion/hook-scripts/mailer/mailer.py

On Debian:

/usr/share/subversion/hook-scripts/mailer/mailer.py

I will continue with configuration for FreeBSD feel free to replace the path for other systems.

Go into your repository hook path, in my case /usr/local/svn/test/hooks

mv post-commit.tmpl post-commit
chmod +x post-commit

Now edit post-commit and add the link to the commit notify program (maybe you have to delete a link to a perl script):

/usr/local/share/subversion/hook-scripts/mailer/mailer.py commit "$REPOS" "$REV"

Now search on your disk for the file mailer.conf.example and copy it into the conf directory under your repository:

cp /usr/local/share/subversion/hook-scripts/mailer/mailer.conf.example /usr/local/svn/test/conf/mailer.conf

Edit the file, I had to change:

mail_command = /usr/sbin/sendmail
from_addr = commit@bla
to_addr = email@bla
reply_to = commit@bla

No commit something to your repository and check if it sends mails.

Send Basic Commit Mails

In your repository on your server there is a directory hooks. Copy the file post-commit.tmpl to post-commit. Now edit it and adapt the lines, I use the following:

/usr/share/subversion/hook-scripts/commit-email.pl "$REPOS" "$REV" svn-commit@<host> \
        --from svn-commit@<host>

Now make it executable. At every checkin an e-mail is sent to the above mentioned email address.

SVN Acces via http://

Add to your vitual host:

<Location /svn>
  DAV svn
  SVNPath /usr/local/svn/overlay
</Location>

Now you can access it with:

svn co http://overlay.idefix.lan/svn/trunk

Switch URL in Repository

Switch URL in Repository

svn switch --relocate old_path new_path
svn up

UTF8 Problems

Problem with special UTF-8 characters

If you got the error message:

Change your local to something like:

export LC_CTYPE=en_US.UTF-8

Subversion