Branching with Eclipse and CVS, Part 1: The Basics
Added 31 Jul 2008
Introduction
In any source control management (SCM) environment, branching is a powerful mechanism for controlled isolation. Despite being a simple concept, controlled isolation is often avoided in practice because of its implementation complexities. This article demonstrates how to perform branching with Eclipse's CVS support. The Eclipse on-line documentation covers this topic, but does not provide an end-to-end scenario. The intended audience is software development professionals with an appreciation for the roles of branch and merge techniques in SCM.This article will employ a scenario of two programmers, Paul and Wing, working on separate branches of the same project. Paul will branch off main and modify some files while Wing continues to work on the main branch, also modifying files. Paul will then merge his branch back to the main branch. In doing so, Paul will address the resulting merge conflicts. This flow is diagrammed below in the Scenario Diagram.
The process is repeated for a second iteration to demonstrate the so-called merge-again scenario. Work continues on the branch after the first merge; then the branch is merged again later. The merge-again scenario requires that you keep track of when you last merged via tags. This will be demonstrated later in this article.
The Scenario Diagram below will be referenced throughout this article.
Part 2 of this article adds the rebase operation to the scenario.
Setup
The sample will use a few text files inside a simple project. In order to carry out the sample yourself, you should already have a working connection to a CVS repository in your Eclipse workspace.If possible, you should considering creating a new repository for this scenario. That's because tags and branches are the central theme of this article. And unlike files in a CVS repository, the tag and branch metadata are difficult to selectively remove if you want to start over. It's much easier to just wipe-out the repository and start with a new one. If you do create your own CVS repository for this article, see the Troubleshooting section in Part 2 for setting the necessary permissions on a new CVS repository.
The setup instructions below can be expedited through importing the brtest.zip into a simple project brtest.
- Create a new simple project called brtest.
- Add a new file called
f1.txt. Add the following contents.