CS 580 Client-Server Spring Semester, 2004 CVS & Store |
||
---|---|---|
© 2004, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 03-Feb-04 |
CVS
Concurrent Versions System
Allows multiple users to work on code
Allows access from multiple machines
Manual http://www.cvshome.org/docs/manual/
Windows Version
http://www.wincvs.org/ client
http://www.cvsnt.org/ server
http://www.tortoisecvs.org/ GUI client and server
Rohan
On rohan need /usr/local/bin in your path
This seems to be in the default path
CVS Books
Manual http://www.cvshome.org/docs/manual/
There are a number of books on CVS
Pragmatic Version Control by Thomas & Hunt has been endorsed by at least one student
http://www.pragmaticprogrammer.com/starter_kit/vc/
TortoiseCVS
Nice CVS client and Server for Windows
Free
Adds CVS menu options in Windows Explorer
Can use Rohan as remote server
http://www.tortoisecvs.org/
Accessing CVS Files on Rohan from Off-Campus
Command line Access – CVS over SSH For complete instructions see the page by Stewart Stremler:
http://www-rohan.sdsu.edu/~stremler/CS530/AS1/remote_cvs.html
First set CVS_RSH environment variable
It points to the location of cvs
On my machine I do this with:
setenv CVS_RSH /usr/bin/sshNote the path
:ext:username@servermachine:/absolutePathToCVSRoot
setenv CVSROOT :ext:whitney@rohan.sdsu.edu:/home/ma/whitney/cs580
Remote Access to Rohan CVS using TortoiseCVS
After you have installed TortoiseCVS on a windows machine, when you right click on an Windows Explorer window the popup menu will contain a CVS items. If you select the Checkout item you will get the TortoiseCVS Checkout Module window. Enter the following:
For the Protocol select “Secure shell(:ext)
For the server enter the name of the machine with the CVS root. For rohan enter rohan.sdsu.edu
For the Repository folder enter the absolute path to the directory containing your CVS root on the server machine
For the User name enter your user name on the server machine.
If your CVS root is set up on the server machine this will allow you to check out files from the server machine. Adding and updating files is also easy to do. One problem is that you will be asked your password each time you make a request of the server. To avoid this read the TortoiseCVS FAQ on how to avoid entering your password every request with SSH at:
http://www.tortoisecvs.org/faq.html#sshkeys
For more information on using TortoiseCVS read the tutorial that comes with TortoiseCVS download.
Example of Using CVS
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
Command
cvs -d cvsLocation initExample
cvs -d /home/ma/whitney/cvsRoot init
Where is the Repository?
cvs command need to know the location of the repository
You can
setenv CVSROOT /home/ma/whitney/cvsRootFor other shells you may need to use:
set CVSROOT='/home/ma/whitney/cvsRoot'
Starting a New Project
Create the directory structure for the project
Example
rohan-> mkdir xmlrpcClient rohan-> cd xmlrpcClient/ rohan-> cvs import -m "start assn1" cs580/xmlrpcClient yoyo start No conflicts created by this import Import Command
Creating a shortcut or Module
Remembering cs580/xmlrpcClient is going to be hard so create a short cut or module
Example rohan-> cd .. rohan-> cvs checkout CVSROOT/modules rohan-> cd CVSROOT/ rohan-> ls ~/CVSROOT CVS/ modules rohan 40-> vi modulesAdd the followng line at the end the file
assn1 cs580/xmlrpcClientNow 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 done cvs commit: Rebuilding administrative file databasecvs commit updates the repository with all changes in the current project
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/': ycvs release –d directoryName
Using our assn1 ProjectGetting the Files rohan-> cvs checkout assn1 rohan-> cd assn1 rohan-> ls CVS/cvs checkout moduleName
Adding a new File
Create a file called client.java using an editor
rohan-> cvs add -m "main client file" client.java rohan-> cvs commit -m "added main" cvs commit: Examining . RCS file: /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/client.java,v done Checking in client.java; /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/client.java,v <-- client.java initial revision: 1.1 donecvs add
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 client.java; /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/client.java,v <-- client.java new revision: 1.2; previous revision: 1.1 done
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/client.java,v Working file: client.java head: 1.2 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 2; selected revisions: 2 description: 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
Comparing Files
rohan-> cvs diff -r 1.1 -r 1.2 client.java Index: client.java ============================================ RCS file: /home/ma/whitney/cvsRoot/cs580/xmlrpcClient/client.java,v retrieving revision 1.1 retrieving revision 1.2 diff -r1.1 -r1.2 1a2,3 > // main > // more code
The diff command shows the difference between versions a file
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
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" assn1The –r flag
We can checkout by version number
rohan-> cvs checkout -r 1.1 assn1
More Features
cvs has more features
Read the manual to find out about
Using Store
Loading Store into an Image
In VW 7.2 Store is already loaded so this step is not needed.
Load the StoreForPostgreSQL parcel
Use the Parcel manager
Packages, Parcels & Categories
Open a System browser
Category
A collection of classes
Use to view any class in the system
Package
A package can contain:
Parcel
File based version of a Package
Runtime grouping of related code
Contains binary for fast loading
Can be created without Smalltalk source if you wish to hide source from users
Using Packages
Creating a Package
Open a System browser and set it to view packages
Adding Code to a Package
Assumptions
Changing an Existing Class
Go to the Integer class
asGrade "Answer the letter grade represented by self" self > 90 ifTrue:[^'A']. self > 80 ifTrue:[^'B']. self > 70 ifTrue:[^'C']. self > 60 ifTrue:[^'D']. ^'F'
Browser Level Source Control
The System browser provides some source control without dealing with Store
To see this functionality
Creating a New Class
Create a new category for your new class
Smalltalk defineClass: #BankAccount superclass: #{Core.Object} indexedType: #none private: false instanceVariableNames: 'balance ' classInstanceVariableNames: '' imports: '' category: 'Store-LectureNotes' BankAccount class methodsFor: 'instance creation' new ^super new initialize BankAccount methodsFor: 'accessing' balance ^balance deposit: aNumber balance := balance + aNumber withdrawl: aNumber balance := balance - aNumber initialize balance :=0
Connecting to the CS580 Store Repository
Before saving a package we must connect to the repository
To connect to the CS580 repository on rugby.sdsu.edu your machine needs a connection to the Internet
In the Launcher Store menu select the “Connect to Repository” item
First Time Connection
In the “Connect to Database” window:
For Interface select PostgreSQLEXDIConnection
For Environment type rugby.sdsu.edu_cs580
Contact me for a username and password
Keep BERN as owner of the table.
If you click on the “Save...” button you can give the settings a name to make it easier to connect later.
Now click on the “OK” button to connect to the repository
If all went well you are now connected to the repository. If you do not get any errors you will be connected.
Viewing Existing Items in the Repository
Once you are connected to a repository you can view its contents
In the Launcher’s “Store” menu select “Published Items”
The resulting window will show you the contents of the repository. When you select a package you will see the different versions of the package. When you select version you see the comment for that version. When a version is selected you can either right click in the upper right window or use the File menu to load that version into your image.
Putting a Package into the Repository
To put a package into a repository