% export CVSROOT=~/CVSRepository
% cvs init(NOTE: notice that the directory ~/CVSRepository now exists)
% cd
% mkdir A1
% cd A1-m option specifies a log message
% cvs import -m "Setting up A1 module - first import" A1 vtag rtag
% cd
% rmdir A1
% cvs checkout A1
At this point you have set up and checked out a working version of your programming assignment. You only need to do these steps 1 - 4 once each time you start a new programming assignment. The rest of these steps (5 - 7) are what you would normally do every time you come in to work on your programming assignment.
% cd A1
% vi A1.java ... etc.
% cvs add fileYou can also use the *.java wildcard to match all the .java files in your directory
% cvs add *.java
% cvs commit fileThis will bring up an editor session for you to edit a log message about the changes you made to this file since the last commit. This is just a log message for you or anyone else looking at the logs to get a high-level idea of what changes were made. You can specify the log message in the commit command using the -m option.
% cvs commit -m "Your log message" fileIf you have several files you want to commit at the same time with the same log message, just don't specify the filename. Only those files that have changed since the last commit on them will be updated/logged in the repository
% cvs commit -m "Common log message for all files being committed"
The normal cycle once you have set up and checked out your module is 5, 6, and 7 above -- edit, add (for new files), commit cycle.
% cvs update -p file > fileNOTE: Be sure to use the -p option.
If you need a different version saved with an earlier commit, use cvs diff or cvs log to determine which revision number you want to retrieve. Let's say you want revision 1.4 in this example
% cvs update -r 1.4 -p file > fileNOTE: Be sure to use the -p option.
Now your working version of the file has been replaced with whatever version you specified. Go ahead and edit and commit when you are ready to commit your changes to create a new revision of this file.
% cd MyProjDir
% cvs import -m "First import" MyProjDir tag1 tag2(NOTE: If -m isn't used on the command line then vi will start so that you can edit a log message. To start typing press 'a' or 'i'. To finish and save the message go to escape mode by pressing ESC and then type ':wq'. You can use a different editor by using the -e option for cvs)
N MyProjDir/log.txt
N MyProjDir/Main.java
No conflicts created by this import
-m "First Import": specifies log message
MyProjDir: specifies name of Module
tag1 and tag2: logical tags which I never use
-e editor
Use editor to enter revision log information.
Overrides the setting of the CVSEDITOR and the EDI�
TOR environment variables.
% cd
% mv MyProjDir MyProjDir.bak
% cvs checkout MyProjDirAnd off you go into the edit, add (for new files), commit cycle.
% cd MyProjDir
Special thanks to Paul Kube, Michele Strout and Adam Barna and Rick Ord for
their help with these
notes.
These notes were adopted from Michele's CVS Notes