Code snippets‎ > ‎Utilities‎ > ‎

SVN


Creation of a new repository


svnadmin create REPOS_PATH

merge

To see the changes between the experimental branch and trunk, go to a clean checkout of trunk and svn merge –dry-run -r 331:HEAD $LOCALSVN/branches/experimental

To get the changes: svn merge -r 331:HEAD $LOCALSVN/branches/experimental

svnserve


Start svnserve on the nas with: svnserve -d -r /volume1/svn

svnsync


svnsync is a tool for creating and maintaining read-only mirrors of subversion repositories. It works by replaying commits that occurred in one repository and committing it into another.

Basic Setup


We assume that you want to store the repository in the current directory.

First, you need to create your destination repository:

$ svnadmin create .
Because svnsync uses revprops to keep track of bookkeeping information (and because it copies revprops from the source to the destination) it needs to be able to change revprops on your destination repository. To do this you'll need to set up a pre-revprop-change hook script that lets the user you'll run svnsync as make arbitrary propchanges.

$ cat <<'EOF' > hooks/pre-revprop-change
#!/bin/sh
USER="$3"

if [ "$USER" = "svnsync" ]; then exit 0; fi

echo "Only the svnsync user can change revprops" >&2
exit 1
EOF

$ chmod +x hooks/pre-revprop-change

svnsync init --username svnsync file://`pwd` http://svn.example.org/source/repos
Copied properties for revision 0
Now you can just run the 'svnsync sync' command to synchronize pending revisions. This will copy any revisions that exist in the source repos but don't exist in the destination repos.

$ svnsync sync file://`pwd`

Continue when a sync action failed


If you get the following error:

Failed to get lock on destination repos, currently held by '...'
svnsync: Couldn't get lock on destination repos after 10 attempts
You can remove the lock with:

svn propdel svn:sync-lock --revprop -r 0 svn+ssh://....

Accessing a repository on a different port


You can add a hostname to your .ssh directory:

host <server>
  Hostname <hostname>
  User <username>
  Port <port>
  ForwardAgent no
  ForwardX11 no
This will allow you to use 'svn+ssh:server/…'
Comments