As software projects become larger, it makes sense to move to a team model of development, where a number of programmers work together to design, implement, document, test, and maintain a project. As Fred Brooks observed, adding more developers to a project can increase the costs of communication substantially. One way to reduce these costs is for developers to work semi-independently on the code while remaining aware of, and staying up-to-date with, modifications by other team members. Revision control systems (RCS) like CVS or SVN provide tools to help make this method of team development simpler.
Managing contributions from different programmers. Revision control lets you keep a shared repository of code in one central location, and makes it easy to keep your local copy of the code in sync with everyone else. And, if someone's code develops a bug, you can revert it without undoing everyone else's changes.
Looking at the history of the code: When was a particular bug introduced? This code worked last week and now it doesn't: what changed? What version of the code added the "reticulating splines" status message?
Going back to an old version of the code. Did this bug go undetected for a while, or is it new? To find out, revert your code to an older version, compile it, and try to reproduce the bug.
Maintaining parallel code branches. For example, after your software is released, you might have "stable" and "development" branches. Bug fixes go into both branches, while only "development" gains new features. Eventually, when it is time to release the next version of your software, you can release the development branch as the new "stable", or alternatively merge a subset of changes back into back into the existing stable branch.
More intensive collaboration. Revision control makes it easier for multiple programmers to work on the very same source files. When you attempt to commit a file, if someone else has edited it, RCS tries to merge the changes. If it can't, usually because someone else has edited the very same lines of code as you, RCS reports a conflict and gives you a file to edit and sort out the conflicting changes. Without RCS, you might not even notice that someone else edited the file, and you'd be stuck with either one version or the other.
TortoiseRCS is a Windows program that integrates RCS features into Windows Explorer (the Windows file browser). Files that belong to a RCS working directory have small overlay icons showing their current status (out-of-date, up-to-date, changed in working copy, etc.); by right-clicking on a file or working directory, you can update, commit, view differences, and execute many other RCS commands.
TortoiseRCS is free software: not only is the software available
as a free download, but you can also get the source code and make
changes yourself. Its homepage is http://www.tortoiseRCS.org/
.
The Eclipse IDE has built-in support for RCS. In Eclipse, the Repositories view allows you to select RCS repositories (both local and remote), and check out projects from those repositories. If a project was checked out of a repository, you can right-click on the project or on files in the project to access a number of RCS operations: update, commit, diff, merge, revert to a previous version, and so on.
For more information on using RCS within Eclipse, see the help sections of the Eclipse documentation. You can access the documentation online, or from the Help | Help Contents... menu in Eclipse.
CVS has, since its introduction in 1986, become the most widely-supported version control system, especially on Unix systems. Some people argue, however, that it is beginning to show its age. In recent years a number of next-generation revision control systems have appeared to address perceived flaws in CVS.
Of the next-generation revision control systems, Subversion is the
closest to CVS in terms of features and usage. Indeed, many of the
subcommands of the svn
command-line interface have the same name and syntax as their RCS
counterparts. There are, however, a number of improvements, such as
better support for copying and renaming files, a separate command for
easier three-way merging, more efficient
handling of large files and binary files (such as graphics), and many
more.
Subversion is available on Multilab. The main web site is at
http://subversion.tigris.org/
;
you can download source code and binaries (including a Windows
command-line program) from this site. Also useful is the book Version
Control with Subversion, available for free online, and also in
paper form. You can also obtain documentation with the svn
help
subcommand. Finally, TortoiseSVN
integrates Subversion into Windows Explorer, much like TortoiseRCS
does for RCS. TortoiseSVN is free software, and available for
download.
Visual SourceSafe is a proprietary revision control system by Microsoft that integrates into Visual Studio. More information is available from Microsoft's Visual Studio Developer Center.
Even more recently, a new model of revision control has appeared,
called distributed revision control. In these new systems, there is
no central repository for the code. Instead, each developer's working
directory contains history information for that user's changes—like
a local repository. To share code, developers exchange "change
sets" or "patch sets" amongst one another, using
operations such pull
(download someone else's patch set) and push
(send someone your patch set). Using these patch sets, a developer
can merge others' changes into his or her local repository; thus
developers can stay up-to-date while working more independently.
Distributed revision control is becoming popular for open-source
projects such as the Linux kernel.
BitKeeper was one of the first distributed revision control systems. It is proprietary software; though once available free of charge (and used by many the Linux kernel developers), the license was changed in 2005 to make it only available only through an expensive commercial license.
git
was developed by Linus Torvalds as a replacement for BitKeeper after
the license change. It is free software (open source), and is used
by most developers of the Linux kernel. One of the major design
goals of git
is to
make branching and merging
very fast and simple. There is a talk
by Linus Torvalds on git
available from YouTube.
darcs
is based on a rigorous "theory of patches", based on
quantum mechanics(!), allowing patches to be rearranged and applied
in a different order when it is safe to do so. Don't worry, you
don't need to be a physicist to use it. Darcs is free software.
SVK uses Subversion to store the local repository, but adds a number of features to support distributed use. It is free software.
Other distributed revision control systems include Bazaar-NG
,
mercurial
, and
monotone
.
Fred Brooks, The Mythical Man-Month. Addison-Wesley, 1995. ISBN 200-201-83595-9.