Subversion is basically a file server with an advantage of letting more than one user modify the files and directory. Unlike a typical file server, changes to your repository (the files and directories that it manages) are tracked allowing you to examine modifications (or their history) and letting you recover older versions of the files.
Let me emphasize one point: using subversion means that you will never lose any committed files or changes to those files. A typical example is accidentally moving a directory from your project, committing the change, and then your harddisk crashing! Ok, breathe deeply and put down the keyboard. If you need to, count to 10. You did not lose anything. Everything is ok and all files are in the server. You can even recover the accidentally moved files.
For more detailed information, the Subversion reference is available online at http://svnbook.red-bean.com.
Daily Use Guide
In this section, I will discuss the minimum tasks required to properly use subversion. The key word here is minimum. For more advanced operations like merging and branching, I would suggest reading up on your subversion client manual or help files. If you're using the command line version, you can easily get help information by coding the following:
- Navigate first to the install location of your Subversion installation and type the following:
C:\Program Files\Subversion\bin>svn help
- Linux or MacOSX
- Just type the following in a terminal
$ svn help
These commands will fill the screen with more options for help which discuss specific information for each capabilities of the subversion client. Please note that for the sake of simplicity, I will refrain from using the windows version of the command-line code and instead assume that the user is using Linux. If you are a Windows user, just prefix each svn command with C:\Program Files\Subversion\bin so you'll get C:\Program Files\Subversion\bin\svn. Further down this document is a list of GUI based Subversion clients that handles all the operations of the command line client and more. They also provide graphical compare and merges that make life a lot easier when working with the repository. I would suggest using the graphical client extensively and only use the command line client when the other is not available.
Checking Out A Working Copy
Getting a working copy of the repository is the first thing that you do to work with subversion. You will only need to do this once and succeeding operations only require that you commit your changes to the repository.
- Windows/MacOSX/Linux: Command Line
- The basic commands follow this pattern
$ svn checkout <URL> <DESTINATION FOLDER>So to get a working copy of Jsoftware's base library, you'll only need to do the following:
$ svn checkout http://www.jsoftware.com/svn/base/trunk/ jlibrary
Executing the above code will create a directory named jlibrary and all the files inside the URL will be copied there.
- Windows: TortoiseSVN
To get a working copy of your project from the repository, navigate to the directory where you want to store your local copy using Windows Explorer. Then Right Click your mouse to popup the contect menu and select SVN Checkout ... to display the checkout dialog box. All you need to do now put in the URL for your project. As an example, to checkout Jsoftware's base library source, put in the following URL:
- MacOSX: SCPlugin
To checkout a working copy in MacOSX using SCPlugin, just navigate to the directory where you want to put your files then CTRL+MOUSE click to pop-up the context menu and select Subversion->Checkout. This will display the checkout dialog box where you put in the URL of the repository and the target directory. To checkout the Jsoftware base library, you can populate the dialog box with the following:
Update Your Working Copy
Sending Your Changes To The Repository
As with any version control system, subversion has a client and a server. Jsoftware provides the server and all you need to do is select the client that would work with your operating system and configure that. Subversion itself provides the base command-line client. It comes with every download of Subversion from their site in http://subversion.tigris.org. When in doubt, use the standard command line client.
Although there are a lot of available subversion clients for Windows (mostly created in Java), the most notable is TortoiseSVN.
TortoiseSVN is the easiest client that I have encountered with its Windows Explorer integration that allows it to be uses without any IDE. As you can see from the screenshot below, it also provides visual cues through icons regarding the state of your working copy of the repository. Installation is quick and painless (although requires a restart) using MSI installer packages from the project download site here: http://tortoisesvn.tigris.org/download.html
Unfortunately, this client only works for Windows NT, Windows XP/2000/2003 and later and won't work with Windows 98, Me and lower versions (believe me I've tried). So if you're still using these "old" OSs, I would suggest using the standard command line client.
Notice to Visual Studio .NET Users - There is a known bug with Visual Studio .NET where it will fail to load projects that contain a directory that starts with a period. This is significant because by default, subversion and each of its clients store your repository metafiles in ".svn" directory. TortoiseSVN provides an unsupported version of their software which uses "_svn" so that Visual Studio .NET won't hang.
If you are behind a corporate firewall or proxy, you may have to take additional steps to get TortoiseSVN to work
There are currently two command line-based packages available in the internet for this OS, one is through Fink and other is from Metissian. The difference between the two is that the package from Metissan is a stand-alone distribution while the other one is an optional package from the Fink distribution which means it may require you to download some files that you may never use.
The SCPlugin project is a MacOSX gui client for Subversion (see below). It is under active development, and the latest release 0.7.3 in March 2009 provides access to most Subversion functionality.
As with MacOSX, it is recommended that you use the standard command line client. Many Linux distributions already include Subversion in their standard packages. The Subversion website lists binary packages for specific Linux distributions.
Although there are also GUI clients available for Linux, I haven't had the pleasure of using them. The two popular packages right now for Linux are:
RapidSVN is a platform independent GUI client for the Subversion version control system written in C++ using the wxWindows framework.
eSvn is a Qt-based GUI frontend for the Subversion revision system.
With the sheer number of available Linux distributions, I would suggest checking your distribution's manuals/how-to/FAQ for guides in installing these Linux subversion GUI-based clients.