What is Subversion?
Subversion is an open source revision control system. What does that mean? – I hear you cry, in a nutshell, it means that you can keep a copy of your files with all the changes you made from day one and more importantly bring back any version you previously worked on. Think about a project you’ve been working on (A web site, programming project, database systems etc.), anything which requires a code base. If your the only person working on this project that you should probably stop reading here (although subversion could be useful to you), but if you work with many people on a project one of the biggest problems is making sure everybody is working on the same code and that where subversion makes things really easy. It can keep track of who has what files, what versions (revisions) of those files and make sure that everybody is working with the same code so you avoid destroying each others work – brilliant.
What do I need?
Depends on which way you want to go about it, I’ve tried both the graphical utilities and just plain old simple command line (which I find much easier), this tutorial covers the command line so you’ll only need one thing to start with and that the subversion client:
The link above will take you to the packages pages where you can download binaries (compiled source) for the popular operating platforms (Mac, Windows and Linux), this turorial assumes you are using Mac / Linux.
What is a repository
A repository can be thought of like a file store, it’s really just a fancy name for a directory and subset of directories / files on you subversion server.
The access control list sorts out who can access your repository and what they can or can’t do, put in basics, you can let your users read / write files, deny access to private directories or just configure guest access so that anybody can read / write. A sample acl file looks like:
[YourProject:/] User1 = rw User2 = rw User3 = rw
This would give complete read / write access to 3 users. Guests would not have any access to your repository.
[YourProject:/Hidden] User1 = rw User2 = User3 =
Only user 1 would have access to the directory /Hidden, users 2 and 3 would not have any access. If you put the two files together, all 3 users would have access to the entire project barring the /Hidden directory which only user 1 would be able to edit – clear enough.
So you have a repository, you have your users set up with their own ACL’s, now you need to stick something in your repository to start working with it. Open up your terminal, navigate to the directory that contains the files you want in the repository and tap in the following:
svn import https://location.of.your.server/repos/your.repository
Now that all depends on how your server is setup, you may have it locally on your computer, or within your lan or hosted on a remote server / hosting service. You’ll need to know the location in order to continue.
Once you’ve imported your files, you still can’t start working with subversion until you have what is known as a ‘working copy’. Navigate to where you would like to store your working copy and tap in:
svn co https://location.of.your.server/repos/your.repositry
This will bring the latest version of the files down from the server for the first time and you should get:
At Revision 1
Great! So now you have a working copy and you can start editing your files under version control. All you need to know now is how to update your files, add and delete and check for difference which we will cover below.
So you’ve edited your files and given your developers / users access to the repository, but how do you put your latest revisions onto the server:
Your computer will access the repository and probably ask you to edit the log file to make a note (On my mac this takes me into a VIM session), if you don’t want to add a note just type
If prompted just press ‘c’ to continue with the upload. Your files will then be uploaded into the repository and tagged as a new revision:
At revision 2
Your developers can simply open their terminal and tap in:
This will update their copies to match your own, so again you are all working from the latest revision. There you go, subversion in a few simple steps. You might want to look up some additional command and command line arguments for svn. You still need to learn about adding / deleting files, and checking the status of your files against the repository. Here’s a clue: