You may use CVS daily for your program, but never touch the collaboration part. In fact, that is the most exciting part. In this tutorial, I will first briefly explain the concepts of trunk, branch and tags. And then use a real team collaboration example to demonstrate how cvs works.
How CVS works?
First of all we need to understand what are trunk, branch and tags.
Trunk is the main version of a project. There is one and only one trunk for each CVS repository.
Branch can be multiple, that is, any authorized developer can create a branch and work on the branch.
Tags are used for tagging multiple files in different versions. (For example, in the project below, Main.java is changed frequently, but Dog.java does not change) By using a tag, we can mark files in different versions in one tag.
An Example of Collaboration in Eclipse
In this example, Mike created a project under eclipse and then share it to CVS repository. (Right click -> Team -> Share Project)
Then Alice checked out the project by using a different project name("CollaborationBranch"), and created a branch on "CollaborationBranch" by right click->Team->Branch and name new branch as Col_1_1.
Now Mike works on the trunk, and Alice works on the branch. Each time Mike and Alice commit a change, the change will be committed to its own Trunk/Branch. There is no interference between those two version. The trunk and branch are totally independent.
After a while, Alice wants to merge some changes that have been made on trunk by Mike. Because the trunk may change something relevant to her own branch. So It is a good idea for Mike to tag the current version, so that Alice can know which version to merge by looking at the tag only. So Mike create a tag named "Tag_1_2". (right click on project -> Team -> Tag as Version) The tag name means trunk is in version 1.2.
Now Alice can merge changes made on trunk (right click on project -> Team -> Merge) and get the following window.
End Tag is the tag that you want to merge, i.e., Tag_1_2 which is created by Mike.
Start Tag is the common Root for Trunk and Branch, where branch is created originally.
Then Eclipse will pop up the following window for comparing and merge.
Now Alice gets what Mike have done on Trunk. They both continue working independently again.
Finally, all branches should be merged to the Trunk, since there normally only one final version of a project. So now Mike has to merge what Alice has done to the main Trunk. By the same approach Mike use the following compare window to merger changed from branch.
<pre><code> String foo = "bar"; </code></pre>