Friday, June 30, 2006

Creating a branch in CVS and using it from Eclipse

Wanna create a branch in your CVS tree and use it from Eclipse for develpoment? Read on...
We had never created a branch in our CVS tree thus far, partly because there aren't very nice visual merge tools for CVS (like clearcase, for example). That makes it a bit tricky to merge from one branch to another - basically you gotta know what you are doing! :).
Anyhow, we reached a point in our development cycle that we had to create a branch for a release. After much googling, I found this concise article which was very helpful. Still, in short, what we did boils down to this:

Set up the branch in CVS:

  • cd your-project-directory

  • cvs tag -R -b tag-name

Checking out code from this branch:

For those using cvs from command line -

    >cvs checkout -r tag-name project-name

For those using Eclipse:

It's slightly more tricky than you'd think :). At first we were all worried since our branch was just not showing up in the CVS Tree. Here's how to get your branch to display there correctly.

  • Go to "CVS Repository Exploring" perspective and select your project from "HEAD"

  • Now right-click on this node and click on "Tag with Existing..."

  • In the dialog that pops up, click on "Refresh Tags". This forces eclipse to go fetch the latest branch and tag information.

  • Now click "Cancel" on the "Tag with Existing..." dialog.

  • Now in the "CVS Repositories" tab in eclipse, you should see your new branch under the "Branches" node (at the same level as "HEAD").

  • Find your module under this node, tagged with the branch you wanted. Then check out as usual by right-clicking on it and selecting "Check out as"

Disclaimer: I'm no expert in doing this stuff, but I've found a way that worked for me. If you know a better way, please post it here!

Comments: Post a Comment

<< Home

This page is powered by Blogger. Isn't yours?