Learning Subversion Branching

I’ve been working on upgrading a JEE application to a new version of Geronimo Application Server.  I’ve gotten part way there, but gotten stuck on an item that will require some time to resolve.  Concurrently with this project, I’ve been converting my desktop development environment from a Windows XP platform to an Ubuntu Linux Desktop platform.  I’ve become fluent over the last decade in the Linux environment, so I haven’t encountered many problems.

The first development application I had up and running on my new Linux workstation was a Subversion repository which I access via the Eclipse plug-in, Subclipse.  I have the entire project I’m upgrading, two years worth of development work, in the Subversion repository under five different components.  I’ve basically only used the repository as a backup mechanism up until this point.  I have learned to submit my revisions in a structured manner with notes on the code changes attached, and have even performed a life-saving recovery from the repository when some code was cooked into spaghetti with errant mouse movements:).

Now for our topic.  I’ve added the project to an Eclipse workspace from the repository on the Linux platform.  I’ve made some modifications to my deployment descriptors on the Linux platform to run the application in Geronimo 2.1.3.  I now need to go back to my Windows platform and continue some application modifications for the exisiting Geronimo 1.1.1 codebase.  Branching to the rescue!

I should have created a Branch when I added the project to my Ubuntu workstation, before committing Geronimo 2.1 deployment descriptors.  I did not do this and went ahead and edited and submitted new deployment descriptors to the repository. No problem, we’ll Branch from the last revision before the Geronimo 2.1 deployment descriptor commit.

I flip my KVM switch over to my Linux workstation, Open Eclipse, select SVN Repository View, select each Project,  and Right/Left Mouse Click on the Branch/Tag option.  I create a new Branch with a _1.1.1 (I tried dashes and spaces, but went for the prettier sort order) extension to each project.  I don’t select the HEAD, but instead select the revision prior to committing the JEE/Geronimo 2.1 deployment descriptors. Now I have a branch that doesn’t incorporate my freshly edited deployment descriptors.

I now need to flip the KVM over to my Windows workstation and check my repository synchronization between the local working copy and the Trunk on the server.  I shouldn’t commit my old deployment descriptors, but I might have modified other code that I haven’t yet committed.  Once I’m satisfied I’ve committed and merged any new code, I Open a New Workspace in Eclipse and Add the Projects from the freshly created Branch in the Repository.  You now have a local working copy of the Branch in one workspace, and a local working copy of the Trunk in the original workspace.

Next Subversion Topic –  Branch Merging

Leave a Reply