MCS273 Introduction to C++ Programming (January 2013)

Version Control in Eclipse using CVS


Overview

My objective with this lab is to teach you how to use the revision control system CVS in Eclipse. When I taught MCS-270 (Object-oriented Software Development) in 2008, I taught the students how to use the command-line cvs program. Fortunately, Eclipse does most of the work for you, and I think you will find that it is fairly easy to use from CVS Eclipse.

Background

In reality, you can't do everything from Eclipse (at any rate, I don't know how to do everything). In particular, you would need to use the command-line cvs program in order to create what is called a repository. In practice, your sysadmin would probably do that for you; in this course, I am functioning as your sysadmin, since I have set up separate repositories for each of the programming groups. I don't mean to make the repository-making process mysterious, since it isn't that hard to do; I just choose not to spend the time here needed to learn that. If you are really interested, you can check out the CVS lab I used in MCS-270 in 2008. I also had Dan Oachs from GTS set up unix user groups for each programming group. Following are those groups:

  • mcs273-j13-1: karl dblomker zjergens
  • mcs273-j13-2: karl ychen cthomas3
  • mcs273-j13-3: karl kdexter hwauck
  • mcs273-j13-4: karl aeide2 ielletso
  • mcs273-j13-5: karl kfeng xwang4
  • mcs273-j13-6: karl hgoldsti njenson2
  • mcs273-j13-7: karl nhamberg tthomps2
  • mcs273-j13-8: karl wmccabe2 aopifici
  • mcs273-j13-9: karl truble jviveros

Links

I'm including these links for completeness, even though you will not need them. Another good reference is the book Pragmatic Version Control Using CVS by David Thomas and Andrew Hunt, which is in the monitor's room. Also, Also, if you go to Eclipse "Help > Help Contents" and select "Workbench User Guide > Getting started > Team CVS tutorial", you will find a nice summary of this process.

Tasks

You should do this lab in your programming groups. It would be best if there were at least two computers with Eclipse in each group, since you are going to learn how to share projects. Since I want to be practical about this, you will share the Logbook project of Project lab 3. So, whoever has the most-recent version of that code should start the tasks listed below.

  1. In the following, when I refer to "groupk", k will be 1, 2, 3, 4, 5, 6, 7, 8, or 9 corresponding to the user group of your group (see list above).
  2. I've decided that I am going to do this along with you, so please wait for me, don't go ahead on your own.
  3. The person who will be sharing their version of Logbook should launch Eclipse in the workspace containing the Logbook project. In the Windows tab, select "Open Perspective > Other...", and then choose "CVS Repository Exploring". Right-click on the open space in the CVS Repositories panel on the left and choose "New > Repository Location". Then fill in the fields as follows:
    Host: ssh.gac.edu
    Repository path: /Net/gac/home/k/a/karl/usr/cvs/mcs273/s13/groupk (Note: change k appropriately)
    user: your username
    password: your email password
    Connection type: extssh
    Use default port: checked
    Use port: unchecked
    Validate connection on finish: checked
    Save password ...: unchecked
  4. After you have set everything as above, click finish. You should then see a new entry in the CVS repository panel on the right.
  5. Now change back to the C++ perspective. Right-click on the Logbook project and select "Team > Share Project...". In the window that pops up, select CVS (if it isn't already selected) and then click "Next >". In the next window, select the repository you just added and click "Next >". In the next window, be sure "Use project name as module name" is checked, and then click "Next >". I believe this is the point where it will create the repository. It will probably ask you about the files with extensions .data and .sql. You should specify the as ASCII files. Before finishing, it will ask you for a comment. Do something simple, like "Initial form of the Logbook project from MCS273, authored by ...", then click finish.
    Check-off: Show me that you have gotten to this point.
  6. Now the other team member should add the same repository as described above. Before getting the project that was just shared, rename your copy of the Logbook to something different, such as LogbookOld. (It would probably be wise to first archive it and put it somewhere else on your computer.)
  7. Next, go to the C++ perspective, right-click on the open space in the Package Explorer, and select "Import..." In the pop-up window, select "CVS > Projects from CVS" and click "Next >". Then select your repository and click "Next...". Then check "Use and existing module (this will allow ...)" and select the Logbook project that your partner had shared. After you finish this, you should see the project in your work space.
    Check-off (1 point): Show me that you have gotten to this point.
  8. Now make some small change to one of the files in the project (maybe add a comment). You should notice that there is an ">" by that file in the Project Explorer; this means that the file is different from the repository. In order to commit your change (in other words, update the repository by making that change), right-click on the file or the project and select "Team > Commit...". A window will pop up listing the file or files that have been changed and ask you to enter a comment for the commit operation; you should always enter at least a short comment summarizing your changes.
  9. Now the other team member should right-click on the project and select "Team > Update".

  10. Check-off (1 point): Show me that you have gotten to this point.
  11. Finally, you should apply the process above to store your project in your repository so that you can then work on it and share changes easily. When doing this, you should start from the one of you that has the most current code, being careful that the other one first archives their version of the project and renames it in their workspace.

  12. Check-off (1 point): Show me that you have gotten to this point.