Subversion HOWTO
Subversion is a really nice version control system that many people have migrated to from CVS. I’ve recently needed to set up my rails applications into subversion repositories so I can make use of the quite proper application deployment tool, Capistrano. I wanted to take a moment and post about generally how using Subversion works—for the reference of people stumbling upon my blog, and also my own.
You can set up subversion to work with Apache or another web server, but I decided to use svnserve, the built-in mini web server specifically for serving Subversion repositories. To use this, you prefix your repository url with svn://, which means to use the default svn port of 3690. On Gentoo, the only bit of configuration was in /etc/conf.d/svnserve. I only needed to set the SVNSERVE_USER and SVNSERVE_GROUP. The default root is /var/svn—a good choice. Fire up the init script, add it to the default runlevel, and you’re ready to import.
Before you import, though, you need to create a fresh repository. Do this with svnadmin’s create command right on the server:
svnadmin create /var/svn/myapp
What you get is a directory of files. Think of this not as your actual repository, but as a pile of files that only act as your repository through Subversion tools. The first thing you’ll want to do is fix the svnserve.conf and passwd files in /var/svn/myapp/conf. I thought I read that the commented out values in svnserve.conf were default, but it took me a while to realize that I had to explicitly set some things for it to work right. My file now looks like this:
[general]
anon-access = none
auth-access = write
password-db = passwd
realm = My App is teh Cool!
And then the passwd file should be pretty straight-forward:
[users]
user1 = thepassword
user2 = anotherpass
And you’re set! (You might need to restart svnserve at this point.)
Now we’re ready for the initial import. Importing is how you initially get your files into a fresh repository. The caveat here, though, is that you don’t want to put all your application files right into the root of your subversion repository because of how Subversion makes use of tags to label releases. So, if your app is in the dir “myapp”, you might do something like this:
mkdir myapp_svn
mkdir myapp_svn/trunk myapp_svn/tags myapp_svn/branches
cp -r myapp/* myapp_svn/trunk
This will create the desired directory structure with your app’s files resting directly inside the trunk directory. Now for the import (right on the server):
svn import myapp_svn file:///var/svn/myapp -m "Initial import"
And you’re app is in Subversion! Be sure and check it back out before you work on it again…
svn co svn://theserver/planner/trunk
(I’m actually using svnX and Textmate to manage my Subversion repositories.)
Hope that was worth something to someone besides me. :)
1 Comment to Subversion HOWTO
@djthread
Categories
- Audio (17)
- Computers (29)
- DJ Thread (42)
- Drum 'n Bass (49)
- General (106)
- Reviews (25)
- Software (43)
- Stuff (23)
- Technology (7)






"Hope that was worth something to someone besides me. :)"
Yes, it twas.