Thursday 2008/06/12
12:32 PM

Categories: Tech, Web Dev, Work

svn:externals and the Versions svn Client

versionsapp.jpg

Update 2008-06-16: The latest beta of Versions (1.0b2 (31)) now allows you to set a different program for comparisons. I set mine to Changes, which I find a bit easier to work with than FileMerge.

I recently stumbled upon Matthew Weier O’Phinney’s explanation of svn:externals and how you can use it to mix stuff from multiple repositories in one project. This helped me when I was setting up a new project at work, since we keep a lot of core code in a centralized repository, but of course each project gets its own separate location. Matthew’s explanation should be included in the svn documentation, which (as he points out) lacks a simple example of how to use svn:externals.

The gist is to navigate to the folder into which you want to check out the external library, and then execute:

svn propedit svn:externals .

Within the editor session you need to add one line for every external library. The order goes: name of local folder, path to external library, like so:

extlib http://www.foo.com/path/to/external/libary

After you save and exit, an svn update on the directory will pull the external library into the folder you named in the property declaration.

I ran into one small issue — the propedit command requires that the environment variable SVN_EDITOR is set, otherwise it’ll bail. I added a line to my bash profile (export SVN_EDITOR=/usr/bin/vi) to point it to vi.

In other news, I’ve been testing out the recently-released beta of Versions. It’s very slick, although it did give me authentication fits when I tried to create a bookmark for an existing working copy. I first had to create a bookmark for the repository, authenticate, and then create a working copy bookmark under that repository.

The Versions interface is very clean, and I find it to be far superior to the other OS X svn clients I’ve used over the last few years (svnX, ZigVersion, SmartSVN). Versions uses the built-in FileMerge app to do comparisons; I would like to be able to assign that functionality to Changes in future versions.

Since TextMate and Eclipse both have very handy subversion bundles/plugins that handle most tasks I find that I rarely need a separate, dedicated svn application, but this one looks to be the best of the lot so far. Of course the joke in the office was that everyone is switching to git, anyway…

Leave a Response