Subversion Rename Rocks!

I don't like revision control systems

I should start off by saying that I'm not a big fan of revision control systems. What I want out of an RCS is simple. Let me check files in and out so that my code is backed up and I can revert and merge as needed. I have found that branches rarely get used except in the biggest of projects. Though your RCS system can probably handle it, developers are still people and you can end up in a lot of trouble when you work on more than one branch at a time. Over the years I have used PVCS, RCS, Contiuum, Source Safe, Star Team (I think that was the name) and a few others. I keep coming back to CVS because it does exactly what I want (backup and store revisions of a tree of files) and does it with a few simple commands. It also has the advantage of being supported everywhere.

So, that said, I have always had two big complaints about CVS. First, I can't do anything when I'm not connected. I want to be able to get the status and add and delete files when I'm flying from Altanta to California. Only when I actually want to commit should I need to be connected to the server. Second, I want to be able to move and rename files and directories. This really isn't asking much, but it's something I've had trouble with in virtually every system I've ever used. They seem to assume that once you've gotten your code heirarchy set up you will only ever add to it. That's just not realistic in the short or long term. In the short term you are playing around and trying different things. Your code base is fluid, and I need a tool that is fluid with me. Once it settles down you are pretty good, but then eventually you have to make wholesale changes farther down the road. In the long term you need to be able to rename and move things as your long term requirements change.

Subversion: where have you been all my life!?

I installed Subversion on my server to manage a few of my own projects. This was mainly just to try it but I hadn't had much chance to play with it simply because I had been busy with work. When Chris and I started the book (Swing Hacks, coming soon!) we decided to use revision control rather emailing files back and forth. Since we each work on our own hacks there wasn't too much need for managing multiple author revisions. In fact, the code doesn't change that much at all. You write it, check it in, and then maybe do two revisions later on during editing. Since the text is all done with Word you wouldn't be doing merging anyway. Really we just needed it for the file sharing abilities. It's worked quite well. You create directories, check in hacks, and do updates. Very smooth.

The best part, though, has come during the editing phase. As we have started assembling chapters we have needed to move everything around and start changing filenames, directories, and order. screenshot.png isn't very descriptive when you have 100 hacks that need screenshots. This is where Subversion has really come into its own. A simple svn rename takes care of everything. We can move any directory or file around and nothing breaks. rename simply works!. When we update the tree all of the changes come accross fine. If I have a directory with a few extra files that aren't revision controlled Subversion will warn me before I rename that directory. I can force it to do the rename and it still does the right thing. This is really the way it should always have been done.

It's coming

Subversion is still immature. The client and server themselves seem quite stable (and fast) but the tool support just isn't there yet. We don't have svn access at java.net yet. I haven't found a webscript to show the source online the way view-cvs does. I don't have a subversion plugin for my favorite editor either. It's coming though. In the long run I don't see a reason to use anything else. Fast, solid and free. Sounds good to me.

Talk to me about it on Twitter

Posted March 24th, 2005

Tagged: java.net