OSCON 2007: Subversion: Powerful New Toys, by Justin Erenkrantz
- Wed Jul 25 2007
- OSCON 2007
- Trackback URL
- comment feed
- digg this post
Subversion is version control software that we’ve recently switched to at the Joint Astronomy Centre. We don’t use any of the really advanced features of Subversion, but after this session we might.
Linus Torvalds called Subversion “the most pointless project ever started.” Awesome.
This session touches on new features since release 1.0. The first such feature is the FSFS repository backend. This was introduced in 1.1 and made the default in 1.2. The 1.0 implementation used a Berkeley DB backend which didn’t scale — the apache.org installation kept getting deadlocks, infinite loops, and corruption, all of which are bad things for version control software.
Optional locking was introduced in 1.2. This allows people to indicate when they’re working on a file that won’t merge well. It’s useful for binary files like Word documents or images. Locks are breakable by force, so you can’t get locked out. They don’t want the locks to get in the way of development. A svn:needs-lock property can be set on a file to essentially make it read-only.
WebDAV auto-versioning was introduced in 1.2 to allow DeltaV clients (Mac OS X Finder, Linux WebDAV FS, etc.) to commit to the repository. A caveat is that while versions are technically preserved, the automatic versions often look weird — files often get deleted and added, it plays havoc with diffs… It’s a “feature” of the WebDAV clients and not of subversion.
Path-based authorization was introduced in 1.3, which allows administrators to partition access to the repository. Authorization tends to be quite slow, but the overhead is in httpd, not Subversion. It’s fairly safe, as for every recursive operation, each path needs to be checked for access.
Operational logging was introduced in 1.3, which allows administrators to track commits, updates, checkouts, etc.
Improved language buindings were added in 1.3, allowing for Python, Ruby, and Perl SWIG bindings. The build requirement of SWIG was removed, and the interfaces were made much more language-friendly.
Added in 1.4 is improved working copy handling. A flat file is now used instead of using XML, as XML lead to fairly large overheads.
Repository replication was added in 1.4, which allows you to replicate the entire repository locally (svnsync init / svnsync sync). An easy way to allow third parties to easily mirror your repository. It’s only a one-way thing though, you can’t commit to the mirror and have it show up on the master repository. SVK relies on this.
A new binary diff algorithm was added to 1.4. It gives you substantial space savings (50% in many cases) and faster operations.
ra_serf is an alternative WebDAV approach that can replace ra_neon (aka ra_dav), and was introduced in 1.4. ra_serf does HTTP pipelining, so it’s faster than ra_neon. It also uses concurrent connections, giving further speed improvements.
In the near future, 1.5 is coming out. True merge-tracking is the last big feature that they’re waiting for before releasing it. Features I’ll talk about from this point on will be in 1.5.
WebDAV transparent mirroring will allow for geographically distributed mirrors. You’ll be able to set up a master server that will distribute updates to slaves via rsync or svnsync, and then clients will be able to read from and commit to these slave servers.
You’ll be able to do a partial checkout of a particular directory. There are a few bugs that need ironing out, and it needs finishing, but it’s in the trunk and will be in 1.5. It will allow you to check out an individual file in a directory, check out only a certain number of directory depths…
Interactive conflict resolution is coming. When you do a merge or update and have a conflict, you can bring up an editor and resolve the conflict immediately before the update completes instead of having to push off the resolution until after the update is completed.
Another quote from Linux: “Merging in Subversion is a complete disaster. They have a plan and their plan sucks too. It is incredible how stupid these people are.” Merge tracking will allow Subversion to, get this, track and record merges. svnmerge.py was introduced in 1.3, but it’s client-side (SVK does something like this as well). In 1.5 this will be pushed into the server.
In the distant future, some features that could come along are speed improvements, offline commits, local branches, and better merging. Subdirectory detachability will remove the .svn directory from each directory in your checkout. New repository formats may be coming. Clients could migrate towards thin Python applications. Atomic renames. Distributed repositories.
