Mastering Subversion in the Eclipse IDE
Introduction to SCM and Subversion
Software configuration management (SCM) is the fine art of keeping source code warm and safe, sharing it with other team members, and protecting it from our own blunders. With a good SCM process, you can easily keep track of releases and new development branches, which makes it much easier to identify and fix bugs in shipped products.
A large number of SCM tools are available, both open source and commercial, such as StarTeam, Perforce, BitKeeper, and ClearCase. In the open source world, the de facto SCM standard is Concurrent Versions System (CVS), which is used around the world for thousands of open source and commercial projects. However, CVS has a number of deep-rooted flaws, which make it less than perfect for modern development projects:
- Essentially designed for text files, CVS handles binary files very poorly. Binary files are transmitted and stored in their totality at each commit, which represents a waste of both bandwidth and disk space.
- In CVS, you can’t move files and directories. Your only option is basically to delete and re-add them, losing all the file history in the process.
- CVS has no notion of atomic commits. Say you commit 10 files to the server, and the commit operation stops halfway through the process. (This can happen quite easily if someone commits a file at the same time, or even if your network fails or your PC reboots.) In this case, the server will have recorded only half of your modifications, leaving the code base in a potentially unstable state.
Subversion is a relatively recent open source SCM tool that was designed from the ground up to overcome the limitations of CVS. It is a finely designed tool with many new features adapted to modern development:
- Commits are atomic. The repository is not updated unless all the committed files can be incorporated correctly in a new revision, and each new revision is made up of only the changes in a single commit. (No one else’s changes can slip in unnoticed.)
- Subversion uses a cunning binary diff on both text and binary files, which optimizes both network traffic and repository disk space.
- In Subversion, each revision represents a copy of the entire directory tree at a point in time. Files and directories can be moved around without limitation.
- Subversion stores only the delta between each version, which saves disk space, and also means that tagging a new version or creating a new branch is virtually instantaneous.
- You can access a Subversion repository in a variety of ways, depending on your needs: using HTTP or HTTPS with WebDAV, using the fast proprietary svn: protocol, or directly via the local file system.