December 18th, 2009
1:46 pm
Branching and Merging in Eclipse CVS and TortoiseCVS

Posted under CVS
Tags , , ,

Branching allows version histories of a CVS module to proceed in parallel, by branching from an earlier version in the repository. This typically arises when a new release is under development in the repository (or has been released) and bug fix changes are needed to an older version without affecting the new release. A branch would be made at the older version and the bug fixes placed on the branch. A client (Eclipse or TortoiseCVS) can pick the branch to work with, and the local files are updated to reflect that branch.

  1. To create a branch in Eclipse, select Team/Branch… from the context menu for the project
  2. To create a branch in TortoiseCVS, select CVS/Branch… from the context menu.
  3. To select a branch in TortoiseCVS, you do an Update Special and pick the branch to switch to.
  4. To select a branch in Eclipse, you do Team/Switch to another branch or version

When Branching, you should normally branch a complete module not just a file. If you just branch a file in eclipse, Eclipse gives you a warning that you are mixing tags within a project. Tortoise does not give you a similar warning however. See here for the internals of branching in CVS. It seems that whilst internally it is done per file due to historical coding reasons, it should ideally be ‘grouped’ as CVS does group files.

If you branch by mistake, you cannot delete it – just leave it unused in the repository.

You can merge changes back into a branch from another branch with both these clients. In both cases, you should have the target branch (which will often be the head) as the current loaded one. You then pick the branch to be merged into it.

  1. To merge a branch into the current branch in Eclipse, use Team/Merge
  2. To merge a branch into the current branch in TortoiseCVS, use CVS/Merge

No Comments »

Trackback URI | Comments RSS

Leave a Reply

You must be logged in to post a comment.