SDSU CS 580 Client-Server Programming
Fall Semester, 2002
Previous    Lecture Notes Index    Next    
© 2002, All Rights Reserved, SDSU & Roger Whitney
San Diego State University -- This page last updated 12-Sep-02


Doc 4, CVS Slide # 2

Concurrent Versions System

Allows multiple users to work on code

Allows access from multiple machines

Rohan doesn’t currently allow remote cvs access from off campus


Windows Version client server


On rohan need /usr/local/bin in your path

This seems to be in the default path

Doc 4, CVS Slide # 3
Some CVS commands

All examples assume you are using Unix

One Time Only

To store your own files you need a cvs root (repository)

This is created once


   cvs -d cvsLocation init

   cvs -d /home/ma/whitney/cvsRoot init

Doc 4, CVS Slide # 4
Where is the Repository?

cvs command need to know the location of the repository

You can
Add this path to each command or
Set the CVSROOT environment variable

Example of setting Environment variable

For tcsh or csh in .cshrc or .login file add a line

   setenv CVSROOT  /home/ma/whitney/cvsRoot
For other shells you may need to use:

   set CVSROOT='/home/ma/whitney/cvsRoot'
The examples assume you have set CVSROOT variable

Doc 4, CVS Slide # 5
Starting a New ProjectCreate the directory structure for the project

rohan-> mkdir xmlrpcClient
rohan-> cd xmlrpcClient/
rohan-> cvs import -m "start assn1" cs580/xmlrpcClient yoyo start
No conflicts created by this import
Import Command
Initial message for the project

where the files are stored in the repository

means nothing, can be anything but must be here
this is the start of the project

After this command the directory is stored in the repository

Doc 4, CVS Slide # 6
Creating a shortcut or Module

Remembering cs580/xmlrpcClient is going to be hard so create a short cut or module

rohan-> cd ..
rohan-> cvs checkout CVSROOT/modules
rohan-> cd CVSROOT/
rohan-> ls
CVS/      modules
rohan 40-> vi modules
Add the followng line at the end the file

   assn1 cs580/xmlrpcClient
Now to commit the changes

rohan-> cvs commit -m "Added assn1 module" modules 
Checking in modules;
/home/ma/whitney/cvsRoot/CVSROOT/modules,v  <--  modules
new revision: 1.6; previous revision: 1.5
cvs commit: Rebuilding administrative file database
cvs commit updates the repository with all changes in the current project

Doc 4, CVS Slide # 7
Now to remove the module files

rohan-> cd ..
rohan-> cvs release -d CVSROOT/
You have [0] altered files in this repository.
Are you sure you want to release (and delete) directory ´CVSROOT/': y
cvs release –d directoryName

Doc 4, CVS Slide # 8
Using our assn1 ProjectGetting the Files

rohan-> cvs checkout assn1
rohan-> cd assn1
rohan-> ls 
cvs checkout moduleName

Makes a local copy of the files in the give module

Doc 4, CVS Slide # 9
Adding a new File

Create a file called using an editor

rohan-> cvs add -m "main client file"
rohan-> cvs commit -m "added main" 
cvs commit: Examining .
RCS file: /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/,v
Checking in;
/home/ma/whitney/cvsRoot/cs580/xmlrpcClient/,v  <--
initial revision: 1.1
cvs add
Tells cvs about the file

cvs commit
Commits all changes in the current project to repository
Can add file name to commit only a single file

Doc 4, CVS Slide # 10
Making Changes

We can now make more changes to the file

At anytime we can commit the files

rohan-> cvs commit -m "added foobar method"
cvs commit: Examining .
Checking in;
/home/ma/whitney/cvsRoot/cs580/xmlrpcClient/,v  <--
new revision: 1.2; previous revision: 1.1

Doc 4, CVS Slide # 11
Getting the log of Changes

We can view the log of changes made to the project

rohan-> cvs log
cvs log: Logging .
RCS file: /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/,v
Working file:
head: 1.2
locks: strict
access list:
symbolic names:
keyword substitution: kv
total revisions: 2;     selected revisions: 2
main client file
revision 1.2
date: 2002/09/12 22:45:17;  author: whitney;  state: Exp;  lines: +2 -0
added foobar method
revision 1.1
date: 2002/09/12 22:44:16;  author: whitney;  state: Exp;
added main

Doc 4, CVS Slide # 12
Comparing Files

rohan-> cvs diff -r 1.1 -r 1.2 
RCS file: /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/,v
retrieving revision 1.1
retrieving revision 1.2
diff -r1.1 -r1.2
> // main
> // more code

The diff command shows the difference between versions a file

Doc 4, CVS Slide # 13
Deleting the local Copy

We can even delete the local copy of the files

This tends to make novices nervous

rohan-> cd ..
rohan-> cvs release -d assn1/
You have [0] altered files in this repository.
Are you sure you want to release (and delete) directory ´assn1/': y

Doc 4, CVS Slide # 14
What is the Point?

So far we have done a lot of work without any benefit

We can get back previous versions!

The -D flag for checkout

We can tell cvs to give us the lasted version of a project before a given time

rohan-> cvs checkout -D yesterday assn1
rohan-> cvs checkout -D "2002-9-11 20:00" assn1
rohan-> cvs checkout -D "2002-9-11" assn1
rohan-> cvs checkout -d "1 hour ago" assn1
The –r flag

We can checkout by version number

rohan-> cvs checkout -r 1.1 assn1

Doc 4, CVS Slide # 15
More Features

cvs has more features

Read the manual to find out about

Doc 4, CVS Slide # 16
The Carrot

The source code in lectures is a available via cvs

On rohan

   cvs -d ~whitney/cs580/cvsroot checkout  xmlRpcBasic

gives you the code in Doc 2

   cvs -d ~whitney/cs580/cvsroot checkout screeningTestCode
gives you exam questions and code you can run to test the answers

Copyright ©, All rights reserved.
2002 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.

Previous    visitors since 12-Sep-02    Next