Subversion (often abbreviated to SVN) is the name of an excellent piece of free computer software. It is hosted at http://subversion.tigris.org/.
Subversion is a version control system: like all version control systems, it keeps a central copy of a directory tree containing files, and can show who changed what when, and can show what the files looked like at any point in time since versioning started. As such, it is mainly used by software and web site developers, but is useful to anyone wishing to track versions of textual documents, or co-ordinate changes made by multiple authors.
The goal of the Subversion project is to build a version control system that is a compelling replacement for CVS in the open source community. The software is released under an Apache/BSD-style open source license.
At time of writing (May 2007), Subversion is at version 1.4.3. It is a stable and mature system. Minor releases with bug fixes and small features come out every few months, and a version 2.0 is being planned. For version control systems, stability and reliability is important. Contrary to much current practice, the Subversion developers were very conservative with the releases, resulting in a long beta phase, and a program which was rock-solid by the time it was version 1.0.
Both clients and servers run on several operating systems: Linux and other kinds on Unix, Mac OS X and Windows (Win32 only - Win95/Win98/WinMe cannot be a server), and also BeOS and OS/2.
Subversion was written because the CVS system was ageing badly: CVS had become unmaintainable for developers and difficult for users. It was not up to the new demands of the internet age for larger and more widely distributed projects. SVN has however proved more successful than just being "the next version of CVS"
Compared to CVS, Subversion is an absolute joy to use. Instead of mucking about with arcane and balky ssh configurations in a CVS client, a repository image can be obtained in a couple of clicks. It's fast, simple, and It Just Works. The repository address is just a URL. A web browser pointed at that URL will be able to browse the repository. (try http://svn.collab.net/repos/svn/trunk/ for the SVN source)
The main features of Subversion are:
- As a replacement for CVS, it does all the major things that CVS does.
- Directories, file name changes and file metadata are versioned. A moved or renamed file maintains full version history.
- Atomic, transactional commits: Committing a group of files succeeds or fails as a group.
- Subversion can be used over the internet, using HTTP for transport, using the standard WebDAV/DeltaV protocol, served by an Apache module. It can also be used off a file share or stand-alone server.
- Branching and tagging are cheap, taking O(1) time and use little additional space in the repository. (by virtue of copy-on-write semantics) This is unlike CVS.
- Subversion was designed from the outset as a client/server system. Costs of changes are proportional to the size of the change (regardless of repository size). Client/server operations just send diffs.
- It handles binary files natively.
- Offline access: all operations except for get and check-in, can be done without using the network. A version history is kept locally, and diff, rollback etc. are done without network traffic.
- Human readable messages are designed for internationalisation (output messages in multiple languages) and log output is in machine-parsable XML format.
Due to the atomic commits, the repository exists as a sequence of numbered versions called "global revision numbers". E.g. before I checked some files in, the repository was at version 123. After, it is at version 124.
Individual files are not given version numbers as such. For instance, a file may have been changed only 5 times, but will still be "version 124" like the rest of the repository (or to be more accurate, it is "the file as it appears in version 124 of the repository"). The files changed in the transition from revision 123 to 124 can be considered to be equivalent to the "changeset" construct used in some other version control systems.
Subversion scales down to one person working off a laptop. You can put your one-person project into a local SVN repository with less than 5 minutes of effort (Assuming you know how. See the references). It's well worth it.
Subversion also scales up to fairly large projects hosted on remote servers with contributors worldwide.
A variety of clients exist – command line tools, GUIs and IDE plugins. TortioseSVN, a windows shell plugin, is quite popular for windows users. The default commmandline tool,
/usr/bin/svn, is popular amongst Linux users.
There are also web-based clients such as Insurrection at http://insurrection.tigris.org/
Developer tools exist to integrate SVN libraries into other programs. Language binding are available for a wide range of programming languages, including Python, Ruby, Perl, Java and C#. Subversion is written in C for portability, so it can be called from C and C++.
Comparisons to other version control systems
A comparisons to CVS is in the text above. Subversion is a "compelling replacement" for CVS, unless you happen to be sold on the exact way that CVS works and have lots invested in CVS, or use advanced replication features. (call
notes that Subversion doesn't yet support distributed mirror repositories, which CVS does. )
Conversion tools exist that will pull across a repository from CVS to Subversion. If you're contemplating starting out with CVS, don't; use Subversion instead.
Over Microsoft Visual SourceSafe it provides:
Subversion has a back end that is rock solid, whereas VSS's is distressingly prone to mangling data.
Subversion works over the internet.
- Subversion supports offline access.
- Subversion has better support for multiple checkouts.
- Subversion has atomic commits.
- Subversion supports file renames, deletes and moves that preserve history.
- Subversion has better and faster support for branching and tagging.
- Subversion has more choice in client software.
- Subversion has clients that work on non-windows platforms.
- Subversion offers a choice of platforms for the back end
- Subversion is free of cost and is open source.
- Subversion allows anonymous, read-only access. Given that Subversion's target user base is open-source developers, this is logical; and this feature may not be of interest to VSS's target user base.
But Subversion may not have as good IDE integration as VSS. Integration efforts are amateurish. However, other amateurs are probably at work on fixing this.
if you are contemplating starting out with Visual SourceSafe, don't; Use either TFS, which is Microsoft's anointed successor, or Subversion instead.
Compared to Microsoft's new system, Team Foundation Server, TFS, the situation is different. TFS is another modern system, and has atomic commits.
- TFS requires a SQL Server back end, so Subversion is far easier to put in for small installations.
- TFS costs a lot.
- TFS integrates into Microsoft Visual Studio. You might like this if you use Visual Studio, or you might not. If you don't use Visual Studio, you're out of luck with TFS. there's no choice of a different client.
- TFS only runs on Microsoft Windows.
- TFS does not work across the internet (though a third-party product called "TeamPlain Web Access" is being bought for this)
- TFS does not work offline.
- TFS is slower.
- TFS does not allow anonymous, read-only access
- TFS is (currently) a 1.0 product. It is better than some 1.0's from Microsoft, but it has some rough edges and restrictions. Subversion is more mature.
- TFS tries to do a lot more than SVN, like builds, code metrics and work-item tracking. SVN does one thing well. In SVN's world, other free tools like CruiseControl and Bugzilla would also be used to build this kind of system.
- TFS allows policies to be applied before checkin. E.g. There must be a comment on the check in, or the code must have been reviewed. This is extensible with c# code.
- TFS has a feature of "shelved changes", i.e. code which is stored on the server and visible to other users if they want to look at it, but is not part of the main check-in tree.
If you're not using any source control at all for your software development, use a source control system: Subversion is a good one which costs nothing, takes a very small amount of time and effort to set up and will pay for itself easily. Then professional software developers will stop shaking their heads in horror at your working practices.
The Subversion home page: http://subversion.tigris.org/
Comparing Subversion and TFS: http://haacked.com/archive/2007/03/02/A_Comparison_of_TFS_vs_Subversion_for_Open_Source_Projects.aspx
Dispelling Subversion FUD: http://www.red-bean.com/sussman/svn-anti-fud.html
How to set up SVN for "single-serving" use: http://blogs.conchango.com/anthonysteele/archive/2006/11/05/Single-serving-source-control.aspx
My own experience