I just went through this and it was a little painful due to incomplete documentation, so I’m summarizing the steps I took here – mainly for my own reference but also in case anybody else needs to do the same thing. Note – this does not cover using Apache to serve the repository remotely, this is a local install only. I’ll deal with Apache when I get round to it.
1. Installation
yum install mod_dav_svn subversion
This grabs the basic subversion packages, and resolve any other dependencies you may have.
When complete try typing:
svn -help
to make sure that all is well and that svn runs.
2. Configuration
Now you can create the actual repository from which you will check in and out your files.
mkdir /var/svn
cd /var/svn
svnadmin create repos
3. Creating projects
The recommended repository directory layout is as follows:
|– project1
| |– branches
| |– tags
| `– trunk
`– project2
|– branches
|– tags
`– trunk
To start with, we’re going to create a simple project:
mkdir proj1
cd proj1
mkdir trunk tags branches
vi trunk/main.c
Edit main.c to contain your code. Now we can add this project to svn.
3.1. Importing
To add your code to the repository do this:
cd ..
svn import proj1 file:///var/svn/repos/proj1 -m “Initial checkin for proj1″
3.2 Checking Out
To create a working copy of the project, you need to check it out. To do this, do:
mkdir work
cd work
svn co file:///var/svn/repos/proj1
3.3 Edit and Update
Modify the copy of main.c you just checked out:
vi trunk/main.c — Add or delete something and save.
And then check in your saved file:
svn commit -m “Modified main.c”
Similarly, if you add a new file to the project, this command will add them to the repository. To delete a file use the delete command:
svn delete trunk/main.c
To recover a previous version of a file, co with the revision number:
svn co -r file:///var/svn/repos/proj1
If you’re not sure which revision number, check the logs:
svn log file:///var/svn/repos
or
svn log file:///var/svn/repos
4. And more
This should be enough to get you started, but there are lots more commands to explore, and of course this is just a local install – svn becomes really powerful when it is set up as a remote server. I’m going to wade through the docs to do that myself next and I’ll record the results here. The svn bible is :Version Control with Subversion.
[ad]