Creating a Temporary Subversion Repository
Sometimes you need to create a temporary Subversion repository for test purposes. Here’s how.
Creating the Repository
To create a temporary Subversion repository for test purposes, all you need to do is:
svnadmin create /home/tag/tmp/temp_repos
This new repository uses the default FSFS database layer.
Local access to the test repository
If you simply wish to access this test repository from your local
machine, you don’t even need to start up the Subversion server. Use
the file protocol directly. Here’s an example, using the svn info
command
to obtain basic top-level repository information:
> svn info file:///home/tag/tmp/testrepo Path: testrepo URL: file:///home/tag/tmp/testrepo Repository Root: file:///home/tag/tmp/testrepo Repository UUID: 8d23c088-e23b-4eea-828f-d863b48cbd24 Revision: 0 Node Kind: directory Last Changed Rev: 0 Last Changed Date: 2006-08-08 08:50:12 +0100 (Tue, 08 Aug 2006)
You already have full access rights to this test repository without requiring to enter any username/password credentials. Effectively, if you’re on the Subversion server you can do what you want!
Remote access to the test repository using svn
Local access may well be good enough to run whatever experiments you
need to run. If, however, you want to access the repository remotely,
you’ll need to start the server. The easiest way to do this is using
the custom svn
protocol:
svnserve --daemon --root /home/tag/tmp/testrepo
Now you can access this repository using svn
URLs.
svn info svn://svnhostname
By default, you will have read-only access to the test repository.
Read/Write Remote access
The simplest way to gain remote read/write access to your test
repository is to edit the svnserve.conf
file. Of course, you’ll want
to be on the host machine to do this:
emacs /home/tag/tmp/temp_repos/conf/svnserve.conf
If you edit this file to read:
[general] anon-access = write
then anyone has read/write access. Alternatively, configure Subversion
to use a password file for authorisation by editing conf/svnserve.conf
and conf/passwd
.
[general] anon-access = read auth-access = write password-db = passwd
[users] harry = harryssecret sally = sallyssecret
When you’re done
When you’re finished with your repository, just throw it away. You can always make another one.
killall svnserve rm -rf /home/tag/tmp/test_repo
Guess What?
Creating a real live production Subversion repository is no different to creating a temporary one. You might make different arrangements to serve it, to back it up, and possibly to access it.
Oh, and you’ll be careful not to delete it.