Table of Contents

Subversion Server

Subversion is a version control system that can be used in software development (including web sites), configuration management (e.g., Cfengine or manual methods), and any other area of work where it would help to have a history of changes made to files.

Subversion web site

Very quick start

Just a bunch of notes at this point. It will be enhanced at some future date.

Example of making the first SVN repository. This example assumes you are not root (hence the use of “sudo”), makes a Cfengine repository, and sets permissions in anticipation of use with either Apache + WebDAV or svnserve:

sudo mkdir -m 775 /var/svn
sudo chown -R apache:wheel /var/svn

Now make a working directory in your home:

mkdir -p ~/cfengine/{trunk,branches,tags}

Now copy your current work files into “trunk/”, for example:

cp ~/.cfagent/inputs/* ~/cfengine/trunk/

Next, create the SVN repository and place files into it:

svnadmin create /var/svn/cfengine
sudo chown -R apache:wheel /var/svn
sudoedit /var/svn/cfengine/conf/svnserve.conf

Edit the configuration file, if necessary. For example, in a private repository you would probably want to set anon-access to be “none” and un-comment the password-db = passwd line.

sudoedit /var/svn/cfengine/conf/passwd

For users on an internal network (intranet), put user names and passwords here. For use on the Internet, use SASL instead (not yet described here).

Now start the server daemon listening on the default port (3690):

sudo svnserve -d -r /var/svn

If necessary, adjust your firewall to permit port 3690 (not covered here).

svn import ~/cfengine svn://localhost/cfengine -m “Creation”
mv ~/cfengine /tmp/  (or ‘rm -rf ~/cfengine’)

Now change to your home directory and check-out the repository, which (unless you specify a destination) will create a directory of the same name as the repository in the current working directory, complete with subversion tags:

cd
svn co svn://localhost/cfengine

Add destination to the “co” (check-out) command if the current directory is not where you wish the files to be stored. See “svn help co” for details.

Now continue development using this new directory. Use svn help to see commands. Commit (“check-in”) your changes with svn ci, and to grab the latest updates use svn up.

Server

For comparison of server types see the official Subversion documentation here and here.

Using with LDAP

I found a good source of information on this web site.

Base checksum mismatch

With pre-1.6 versions I found it fairly common that Subversion would end up with a checksum mismatch and refuse to update a file. To fix this you move the file away, delete it, move it back, and re-insert it. For example, if the file is “foo.cf” you could:

mv foo.cf /tmp/
svn rm foo.cf
svn ci
mv /tmp/foo.cf .
svn add foo.cf
svn ci

Since upgrading the version 1.6 I have not seen this problem surface.

Ignoring Certain Files

To ignore debugging and other files you never want to go into the repository, so that they don't show up with a question-mark when you run “svn status”, just do this:

svn propedit svn:ignore ./path-to-ignore

An editor window will open where you can enter as many file patterns as you like, one per line, or just “*” for everything.

Warning: you can edit the ignore patterns by re-running the command, but removing it entirely does not seem easy. I tried just deleting the file it created and made a mess of my directory (which is no big deal: I just did a new "checkout", but it was a bother).

For example, I put my debugging output in a directory called “tmp” so I did:

svn propedit svn:ignore ./tmp

… and then I entered an asterisk (*) and saved. Then when I ran “svn status” I saw an “M” in the column of the items to be ignored. I'm not sure why it showed an “M” rather than nothing. When I restored with a fresh checkout (above note) I gave up on this feature as more trouble than it's worth.