|
|
|||||||
|
||||||||
|
Last updated: 7 Jan 2006
Using CVSHere is some basic information about using CVS, with some specific information for our setup, which does not use the pserver but relies on ssh to provide access to the server. That means that you use your INSTTECH login account and password to access the repository server, whether it be for your own repository or for a team repository. Please note that a "module" and "project" are the same concept and the terms are used interchangeably. They are generally represented as a file system's directory of files and subdirectories. However, we will use "module" here to indicate a named collection of information stored in the CVS repository. Also note that the default behavior of CVS is to work with source code, which means files that you can easily read in an editor. Binary files require more vigilance and an extra option (e.g., -kb) on the cvs command to handle. Here is the Official Wiki Version of the CVS Manual, which contains an overview and sample CVS session, as well as details on all of the commands an options.
Initializing CVS for Individual UseYou only need to do this once. Team accounts already have CVS set up.
Using CVS ToolsThese instructions use a command shell and the cvs command to use CVS; there are GUI tools (e.g., jCVS, Eclipse) that may make maintaining your repository easier. However, the GUI tools usually wrap and invoke the underlying cvs subcommands to do the job, so these instructions are fairly universal. The GUI tools require the same information as the cvs command or the environment variables it can use, but often the information is broken down into smaller chunks like "SSH Server" and "repository path". When a cvs command runs, it will prompt you for a password -- this is your INSTTECH login password, not your UW email password. Basically, you need to tell CVS what you will use to communicate with it, then specify enough information to allow it to connect to the server. For a command shell, set up an environment variable called "CVS_RSH" and point it to the ssh command. Setting up the "CVSROOT" environment variable saves typing a cumbersome connection string for every cvs command. Note that you should set up the following environment variables prior to running any cvs command (but only once time in a command shell -- the shell remembers environment variables until it is closed). You could also place the name-value information in a Linux .bashrc file, or on Windows in "My Computer/Properties/Advanced/Environment Variables" for more permanent setting.
where uwnetid is your UW Net ID, and cvsid depends on whether or not you are using a team account: if you are, then it is the team account name; if you are not, it is your UW Net ID.
Creating a New Module
Checking Out a Module
Adding Files to the ModuleOnce a module is set up, you normally want to checkout the whole thing as a working directory, or some part of it, work with all or part of the checked out material, then discard or check them back in ("commit") or add new material.
Viewing Changes to a File Using DiffIf you are unsure of what changes were made on a modified file, (you don't remember changing it) or you want to see changes between older revisions, use the name of the file in question to compare your local file with the same remote revision, using the "diff" subcommand.
cvs diff homework1\test.java
Getting a Clean Copy of a FileIf after running a diff on a file, you discovered that the file was changed accidentally, and you want to get rid of all the changes without checking them in, then use the name of the file and the "update" subcommand.
cvs update -C homework1/test.java This will wipe all of your changes and replace it with the fresh version from the server. If you selected the wrong file, or you decided later that you did want those changes, cvs has made a copy of you file for you. If you were working on "test.java" (version 1.2) and you decided to get the clean copy of the file, you will notice a new file called .#test.java.1.2 which is a back-up copy of the file you just wiped.
Checking in Modified FilesAfter you have modified a file and you are satisfied with the changes, save your file, and run the "update" subcommand.
cvs update homework1 This will verify with the server that these files have actually changed, and if you are working on shared code, it will check to see if anyone had changed any of the files between the time you first checked them out and now. Your changed files will show up preceded by 'M'. If there are not any conflicts (read the next section if your file is marked with 'C'), commit the files. Add an appropriate log message.
cvs commit -m "Final version" homework1/test.java These log messages are what show up when you are looking for older versions of your code.
Conflict ResolutionIf you performed an update on a file or folder, and any of your files were marked with a 'C', there is a conflict between updates that needs to be resolved.
The Rest of the StoryThere is a lot more to CVS than is presented here, including a whole other category concerning the administration of a CVS server (which can be enlightening to read, but is not necessary to use our CVS server). Please refer to the Official Wiki Version of the CVS Manual for details.
Change Log
Hours | Support Information | News | Policies | Emergencies |
|||||||