Everyday Coder

eve·ry·day cod·er [ev-ree-dey koh-der, noun]
a person who designs, writes and tests computer programs daily

Subversion Goodies

I use Subversion for source code management now on all my projects. Before, I used to use CVS like everyone else. Recently I discovered some things about subversion that I hadn't known.

On Windows, I *can* use putty as an ssh wrapper for subversion (svn+ssh://). This was a welcome surprise, because I was using TortoiseSVN which included its own ssh wrapper. TortoiseSVN is widely accepted among most developers on Windows, but I'm still used to the old CVS command line ('cvs up', 'cvs co', etc) and I always hated wading through Explorer to do an update. Anyway, I happened to notice a Subversion folder in my Application Data folder the other day. I went in there and found a file called config. In that file, I saw the old familiar line commented out:

# ssh = $SVN_SSH ssh

I immediately uncommented the line and changed it to:

ssh = \\putty\\plink.exe

In my CVS days I did know that plink is the program you use to tunnel through ssh. I tried to go in and run svn, but I kept getting a "file not found" error. I then looked more carefully at the config file and noticed there was a commented-out section: [tunnels]. I uncommented this section and it worked! That was easy.

My other great discovery was that SVN does, in fact, support keyword substitution like our old friend CVS. You know, $Id$, $Revision$, etc. I have such a habit of putting '// $Id$' at the top of my source files; its not even funny. So the following command magically makes keywords work for svn:

svn propset svn:keywords "Id Author Rev" build.xml

There are more keywords, of course, and you can see the reference to them in the subversion documentation. Executing the above command works for the file given, but if you want it to work with every file, you'll need to specify the keywords in the [auto-props] section of your subversion config file (See above). After trolling a bit, I did find a nice example of a subversion config file on an Apache site.

I hope you put these "discoveries" to good use.

Trackback URI | Comments RSS

Post a Comment