Quick Intro To Wincvs: 1 What Are Cvs and Wincvs
Quick Intro To Wincvs: 1 What Are Cvs and Wincvs
T.S. Norvell Engr 7893. Memorial Unversity of Newfoundland August 26, 2002
CVS is a revision control system. It can track changes to the les in your project and inform you of conicts created when two developers make changes to the same le. We are running CVS on tera.mun.ca, where it maintains a repository containing all source code that you submit to it. How does CVS help Consider the following scenarios. Akbar has just written a class. Je needs the this class before he can complete his coding. Akbar could email the code to Je and all the other members of the team. This results in a lot of email and a lot of duplicated work as all the team members try to keep their working copies in sync. With CVS, Akbar submits his completed class to the repository and all the other team members can easily synchronize their copies. Akbar and Je change dierent parts of le CSoccerDoc.cpp. Akbar could email his copy to Je who looks at the dierences and produces a le reecting both changes. Then Je emails this merged copy to all other team members. This requires Je and Akbar to be aware that they are both working on the same le at the same time. With CVS, Je and Akbar both submit their changes to the repository. CVS automatically creates a merged copy. Akbar and Je change the same part of the same le. In this case when the second one submits his code he will be informed of the conict and asked to resolve it prior to submitting the code. Binky reports a bug in the released version. Akbar and Je are midway toward the next release. While they can x the bug, it will be months before they have a version that is stable enough to release. With CVS they can recreate the source code of the last release version, make the x there, and send a service pack to their customers. They can also merge the change to the release version into their current version. Akbars hard-disk crashes. With CVS only changes made since the last time he submitted changes to the repository are lost. WinCVS is a graphical user interface that makes the CVS client easier to use.
2
2.1
Common procedures
Installing WinCVS:
Skip this step if WinCVS is already installed. Obtain WinCVS 1.2 binaries from www.cvsgui.org. Unzip into a temporary directory. Execute Setup.exe and follow the instructions. Reboot. Optionally make a desktop shortcut and associate a short-cut key with it.
2.2
Logging in
Start WinCVS. Select menu item Admin / Preferences...1 In the WinCVS Preferences dialog set CVSROOT to [email protected]:/user/other/cvs/repos where yourUserName is replaced by your CCAE Unix login name. In the same dialog set Authentication to passwd le on the cvs server. In the same dialog select the WinCVS tab and set the HOME directory. At MUN, I suggest using M:\ as home. Click Ok to exit the dialog. Select menu item Admin / Login... . In the Password Authentication dialog, enter your CVS password (given to you by your prof.) and click Enter. If you have trouble, check in the log window to see if WinCVS is using the right user name. If it refuses to use the right name, then select menu item Admin / Command Line, enter the following command: cvs -d :pserver:[email protected]:/user/other/cvs/repos login and click Ok. The main eect of logging in is to record your password in the home directory you selected.
2.3
Logging out
Before shutting down WinCVS, you should log out using menu item Admin / Logout. The main eect of logging out is to erase your password from the client machines disk.
1 The
2.4
The tree of les on the server that makes up your project is called a module in CVS lingo. I have created a module for each student team. The names of the modules are red, green, blue, purple, and orange. Checking the module out makes a working copy of the module on the client machine. You only do this once for each working-copy. Select menu item Create / Checkout module... In the Checkout Settings dialog set the module name to your teams name. Select a local folder. M:\ will do. On the Globals tab deselect Checkout readonly. Click Ok to leave the dialog. Select menu item View / Refresh
2.5
You can make changes to the les and directories now. After you add any les or directories you should use CVSs Modify / Add selection command to tell CVS about the new les. To delete a le, it is best to use CVSs Modify / Remove selection command. The le will be deleted later. To delete a directory remove all its les. After the next Update, the directory should go away.
2.6
Updating
From time to time you will want any changes that others have made to the module reected in your working copy. To do this you must update your local copy. This assumes that you have already checked the module out. Select the module in the Modules tab of WinCVS. Select menu item Modify / Update selection.... In the Update Settings dialog, select Create missing directories that exist in the repository. Click Ok. 2.6.1 Conicts
A conict in CVS terminology happens when two developers modify the same part of the same le. If you have made changes that cause a conict, the update command will tell you. Watch for lines like: C someFileName
in the log window. The C stands for conict. In WinCVSs le window, the le aected will have a Status of Conict. Editing the le will show you where your changes conict with others. Using the Query / Log selection command you can nd out who made the change. Edit the le to resolve the conict. Not all mutually incompatible changes are considered by CVS to be conicts. For example suppose that a subroutine has been declared with declaration int intpow( int exponent, int base ) Developer A and B start the day by updating their working copies. Both start with the same source. Developer A changes the order of the parameters in the declaration and denition. Developer B writes several calls to the subroutine using the original order. A updates (there is no change) and commits (see next section). Now B updates (getting As changes) and commits. CVS will not notice any problem. However CVSs denition of a conict is good enough for most purposes.
2.7
Committing
From time to time you will want to send changes that you have made to your fellow developers. It is a good idea to do this whenever you have made signicant progress that they may benet from. It is a bad idea to do this when your code does not compile. First update your own working copy. Resolve any conicts. Select the module in the Modules tab of WinCVS. Select menu item Modify / Commit selection.... Type in a log message describing all the work you have done since your last commit. Click Ok.
The above only scratches the surface of what you can do with CVS and WinCVS. You can inform others of your intention to edit; you can have CVS email you when someone has done a commit; you can recreate earlier versions of the module; you can create branches that represent parallel versions of the module; and so on. For more information see the CVS manual at http://www.cvshome.org/ A free book on CVS (but not WinCVS) is available at http://cvsbook.red-bean.com/ A copy of this book will be on reserve in the library. There is a nice site on WinCVS at http://www.computas.com/pub/wincvs-howto/ No revision control system will replace communication between developers and careful project organization. Make sure that you all know what the other developers are doing (or at least which parts of the source they are working on). 4