Client-Server Programming
Spring Semester, 2005 CVS & Store |
||
---|---|---|
© 2005, All Rights Reserved, SDSU & Roger Whitney San Diego State University -- This page last updated 31-Jan-05 |
CS 580 Client-Server Programming Spring Semester, 2005 Doc 3 CVS & Store
Accessing CVS Files on Rohan from Off-Campus
Packages, Parcels & Categories
Connecting to the CS580 Store Repository
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 2 |
http://www-rohan.sdsu.edu/~stremler/CS530/AS1/remote_cvs.html Stremler’s remote CVS on Rohan page
UCB InfoSys 255 course information on CVS & Eclipse http://www.sims.berkeley.edu/academics/courses/is255/f04/labs/lab090904/CVSHowTo/eclipseCvsHowTo.html
CVS Eclipse Plug-in FAQ http://dev.eclipse.org/viewcvs/index.cgi/9.413005E-261checkout2.037941E-312/platform-vcm-home/docs/online/cvs_features2.0/cvs-faq.html
Source Code Management Guide, doc/SourceCodeMgmtGuide.pdf in VW 7.x installation
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 3 |
Concurrent Versions System
Allows multiple users to work on code
Allows access from multiple machines
Manual http://www.cvshome.org/docs/manual/
http://www.wincvs.org/ client
http://www.cvsnt.org/ server
http://www.tortoisecvs.org/ GUI client and server
On rohan need /usr/local/bin in your path
This seems to be in the default path
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 4 |
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/
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 5 |
Nice CVS client and Server for Windows
Free
Adds CVS menu options in Windows Explorer
Can use Rohan as remote server
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 6 |
Eclipse has a GUI interface for accessing CVS repositories
Can access local & remote CVS repositories
See
Must create the CSV repository root first
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 7 |
All examples assume you are using Unix
To store your own files you need a cvs root (repository)
This is created once
Command
cvs -d cvsLocation init
Example
cvs -d /home/ma/whitney/cvsRoot init
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 8 |
cvs command need to know the location of the repository
You can
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'
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 9 |
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
After this command the directory is stored in the repository
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 10 |
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 ~/CVSROOT 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 done cvs commit: Rebuilding administrative file database
cvs commit updates the repository with all changes in the current project
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 11 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 12 |
rohan-> cvs checkout assn1 rohan-> cd assn1 rohan-> ls CVS/
cvs checkout moduleName
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 13 |
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 done
cvs add
cvs commit
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 14 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 15 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 16 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 17 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 18 |
So far we have done a lot of work without any benefit
We can get back previous versions!
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
We can checkout by version number
rohan-> cvs checkout -r 1.1 assn1
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 19 |
cvs has more features
Read the manual to find out about
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 20 |
For complete instructions see the page by Stewart Stremler:
http://www-rohan.sdsu.edu/~stremler/CS530/AS1/remote_cvs.html
It points to the location of cvs
On my machine I do this with:
setenv CVS_RSH /usr/bin/ssh
Note the path
The general format is:
:ext:username@servermachine:/absolutePathToCVSRoot
For example I use:
setenv CVSROOT :ext:whitney@rohan.sdsu.edu:/home/ma/whitney/cs580
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 21 |
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.
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 22 |
In VW 7.3 Store is already loaded so this step is not needed.
Load the StoreForPostgreSQL parcel
Use the Parcel manager
The “Load Parcel” icon is the left more icon on the icon bar.
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 23 |
Open a System browser
System browser now supports three ways to organized code:
In the System browser use the “Browser” menu to switch between viewing the code via these methods
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 24 |
A collection of classes
Use to view any class in the system
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 25 |
A package can contain:
Development time grouping of related code
Packages can be stored in a repository
Can be grouped into bundles for large projects
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 26 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 27 |
Open a System browser and set it to view packages
In the System Browser “Package” menu select “New” and the submenu item “Package”
You will be prompted for a package name
For this document I will use the name “StoreLectureExamples”
With your new package selected in the System Browser “Package” menu select “Make Current”
This will cause any change you make anywhere in the system to be part of your package when you are dealing with Categories
Now you can set the browser to show categories until you are ready to save your code to the repository
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 28 |
Assumptions
We will
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 29 |
Go to the Integer class
Add the asGrade method to the converting category
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'
In the bottom of the browser you should see that method is in your package. See below.
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 30 |
The System browser provides some source control without dealing with Store
To see this functionality
Now click on the “Undo” icon to undo the last change
You can rollback all the changes to asGrade with the undo icon
Use the redo icon to redo each change
To see the history of all changes to asGrade
While asGrade is selected, in the browser “Method” menu select “Browse Versions”
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 31 |
Create a new category for your new class
Then create a new class
For the notes & class demo I will use the following 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
Now to save our package in the repository
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 32 |
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
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 33 |
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.
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 34 |
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.
CS 580 Spring 05 | Doc 3, CVS & Store Slide # 35 |
To put a package into a repository
There are a number of other useful things one can do like merge different versions of a package. However, you should know enough to read the manual to find out how to do that.
Copyright ©, All rights reserved.
2005 SDSU & Roger Whitney, 5500 Campanile Drive, San Diego, CA 92182-7700 USA.
OpenContent license defines the copyright on this document.