Preparation --------------- A group has only one cvs repository. The repository should be owned by one of the group members. Here are the instructions how to create a repository in Computing Centre: Let us assume that user names of the group in Computing Centre are user1, user2, and user3. Repository is now created under the directory ~user1/t2-repository/ (XXX is, for example, your group number) user1 does the following: cd; group create t2XXX user1 user2 user3; mkdir t2-repository Wait untill the /etc/group is updated. This happens normally once an hour. After that, user1 continues: cd; chown user1.a-t2XXX t2-repository/; chmod 2770 t2-repository/; chmod o+x . cvs -d ~/t2-repository/ init cd; wget http://www.cs.hut.fi/Opinnot/T-106.3100/K2006/Projekti/toroidtoe-simpleconfig.tar.gz; gtar xvzf toroidtoe-simpleconfig.tar.gz; cd toroidtoe-simpleconfig; cvs -d ~/t2-repository/ import -m "new project" T2_2006 user1 start cd; rm -r toroidtoe-simpleconfig/ toroidtoe-simpleconfig.tar.gz After that, each team member logs into Niksula and sets the CVS_RSH environment variable to 'ssh'. After that (in Niksula): cvs -d :ext:<user-n>@obelix.hut.fi:/m/fs/user1/b/22/user1/t2-repository/ checkout T2_2006 /m/fs/user1/b/22/user1/t2-repository/ should be the absolute path to the repository so change it. <user-n> is your personal accaount in cc. AFter you have done all this, all team members have a local copy from the repository in T2_2006 directory. When CVS is used, -d flag is no longer needed, but CVS_RSH should still be ssh. Note that the computer you contact should be some linux machine. For some reason checkout from kosh requires read permissions for ~user1. If someone knows the reason for this OS problem, let us know. Make sure that your local copy from the repository is not readable for other users. Usage --------- After checking out your local copy, it's time to make changes. Modify all the files you want, then go to the root of your local copy and type: cvs update Updating is important, since commiting your changes will not work until you have resolved all conflicts arising from modifying the same files that were modified by other users at the same time. When updating, cvs will detect any possible inconsistencies (same point in file modified by multiple people) and mark them. If this happens, user must resolve these changes by editing the file and combining the differences by hand. However, there can be several changes into a same file and cvs will automatically resolve conflicts if the changes are not made into same places in the file. After updating, when all the conflicts are resolved, the user may commit his or her modifications to the repository by going to the directory where the modified files are, and issuing: cvs commit This will open a text editor and allow to write a short description of the changes that were made. If the user dows not bother to do this, it is often a lot more advantageous to write the comment to the command line: cvs commit -m "Fixed the logfile bug in class FooBar." If the commit fails, the user must do cvs update again and repeat the process. In practice, conflicts should not be too common (and thus pose any real difficulties) in a three-person project. Tip: If the users wish to avoid yping the -d flag, they can use the CVSROOT environment variable, that describes the location and options of the repository: setenv CVSROOT "<user-n>@obelix.hut.fi:/m/fs/user1/b/22/user1/t2-repository/" CVSROOT should not be needed after the initial checkout, after which the location information is stored in the directory of the local copy. There are some other useful commands: cvs diff Shows the differences between your local version and the version in the repository. cvs log Print log information for files. cvs history Show what has been done and by whom. cvs add <file> Adds a file to the repository, data will be transmitted on next commit. After this, all update commands by other users will download the file. cvs del <file> Deletes a file from the repository. File will actually be removed from the repository in the next commit. After this, all update commands by other users will cause their local copy to be deleted. Other notes Finally, it might be a good idea to say (in Niksula or in CC;) man cvs Also, there exists an somewhat popular alternative to cvs called SVN (Subversion), but it is not supported by CC or Niksula. If someone of the group has a unix box available, it might be worth checking out (I personally prefer it -Tatu): http://svnbook.red-bean.com/ If can use SVN if you like, but if you use it make a README.svn file to your project, where you tell this. We are interested about the log files and SVN log files are slightly different when compared CVS log files. -- T-106.3100 Intermediate Cource in Programming T2 Petri Ihantola & Tatu Kilappa (much from the matarial is ripped from Riku Saikkonen)