Skip to main content

Subversion Support in NetBeans 5.5

Posted by joshy on December 18, 2006 at 9:40 AM PST

I've been so busy with NetBeans 6.0 work that I haven't commented at all on NetBeans 5.5. We just went final about a month ago and had a big party in Prague. 5.5 is a big release, though most of the work is under the hood or on the server side and being a client side developer it doesn't affect me much.. The new Visual Web Pack is pretty nice though. There is one feature, however, that I am really excited about and that I use every day. Subversion support. With NetBeans 5.5 you can download Subversion support through the Module Update center, and it will be built in to NetBeans 6.0. So let's dive in. What is Subversion anyway?

What is Subversion?

Subversion is a version control system. It lets you set up a repository of that developers can use to share code and track changes to it. The most common one in the open source world is CVS. CVS is great because it's everywhere and has good tool support, but it has some serious flaws. Subversion was designed as a replacement for CVS, improving on it in pretty much every way. And, like CVS, it's completely open source and starting to get good tool support.

Why is Subversion Awesome?

Subversion is basically CVS with the bugs fixed and the sharp pointy bits rounded off. It improves upon CVS in pretty much every way while still keeping the same basic model. Here's just a few of the things that Subversion (also called SVN after it's 'svn' commandline program) get's right.

  • Atomic commits. When you commit a bunch of files at once in CVS they are turned into a whole bunch of separate commits instead of one big one. This means you can't roll them back as a unit, or track them as a unit. With SVN you aren't changing a file, you are changing the entire structure of the tree as a unit. This means you can easily track and rollback changes as a group, the same way the developer committed them.
  • Working offline. You can edit files and to diffs and status checks without having access to the server. Only when you actually commit does the server need to be there. This is great for hacking code on long trans-atlantic flights.
  • Standard Protocols. Subversion uses HTTP and WebDAV as it's main transport protocol. This has two huge benefits. One, you can easily set up a Subversion server by using the mod_dav and mod_svn modules for Apache. This gives you easy maintenance and access control through a standard mechanism. You can even use HTTPS! Second, HTTP goes through firewalls better than anything else. No more futzing with SOCKS proxies and ssh tunnels to make CVS connect when you are at work.

Why is NetBeans Subversion Support Awesome?

Works like CVS. Previously Subversion support was an addon to the older versioning control system. Only CVS uses the modern API. Now Subversion does too, and it acts the same way. This makes switching between the two very easy. (very common when switching between java.net projects which can be either)

Built in. For 5.5 you can download it from the update center and in 6.0 it will be built in (I use it every day, actually). Nothing extra required.

You can still use the commandline. NetBeans acts like a good Subversion client, storing all of the versioning information in .svn directories. This means you can easily switch between the NetBeans client and the commandline version. For doing advanced Subversion tasks that aren't built into NetBeans this can be quite useful. For day to day use I say in NetBeans but it's nice to know that I could drop down to the command line if I need to.

change visualization NetBeans will icon badge and change the color of every buffer you have open as well as the source files in your Project view. This lets you know at a glance what has changed. You can also use the Show Changes command to see a list of changed files project wide and compare it to the server. You can also call the Show Changes command on just a directory branch of the tree. I do this all the time when I want to update something in the painters part of swingx, but not the whole project.

diff view NetBeans has a diff view which will show you both the server version and your current local version of any given file. When merging it will show you a third version at the bottom combining the changes of the two. You can use this tool to see what a merge will do. My only complaint is that you can't edit the file being diffed as I could in jEdit. I've been told that's coming in a future version, however.

Conclusion

Subversion really is a great tool. It provides almost everything I've ever wanted out of a revision control system. You can now choose Subversion instead of CVS when you create a java.net project, so it's great to finally have good support for it in NetBeans. You can learn more about the subversion support in Netbeans at http://subversion.netbeans.org/. Let me know what you think. What are you're favorite Subversion features and tips?

Related Topics >>