General Tips on using CVS. Checking out a Working Directory (locally) ========================================== To get a working copy of a repository you must issue a cvs checkout command. If you work on one of the Linux boxes of the DSG group, where the directory /net/dazdak/cvsroot is visible, you can do: cvs -d /net/dazdak/cvsroot checkout mrg Which creates an mrg directory and all its sub-directories. Checking out a Working Directory (remotely) =========================================== If you are on a machine where /net/dazdak/cvsroot cannot be mounted, you need to use cvs remotely with ssh. You must have a departmental account and be member of group dsg (type `id' to check this). You also have to configure ssh to login without the need to enter a password or passphrase. Then set export CVS_RSH=ssh Then issue cvs -d :pserver:@azdak.cee.hw.ac.uk:/data/cvsroot checkout papers Replace with your own username. This will checkout all papers. Use papers/ to just checkout . Notice that when you are working in a repository, CVS will use the root held in its administration file CVS/Root. This means there is usually no need for the -d argument after the initial checkout. Working with local copies (the CVS "working directory") ======================================================= You can freely edit and add files to your local copy of the repository. To make changes to the master copy, you must issue a commit command: cvs commit -m"" To add new files to the repository (once they exist in your local directory), use cvs add cvs commit -m"" For a new directory, only the add command is needed. To merge changes and add new files made by other people into your copies: cvs update To additionally add new directories made by other people: cvs update -d See "man cvs" or "info cvs" for (much) more detail. Using with Emacs ================ CVS is understood by the Emacs VC (version control) package. See Tools -> VC on XEmacs. There is another Emacs package called pcl-cvs, which provides a useful command: M-x cvs-update Which performs "cvs update" Time and version stamps in files ================================ Sequences like Id Revision Where =$ get expanded into time/version stamps. For example, $Date: 2002/05/30 14:34:18 $ See "man co" for details on these. (CVS inherits them from RCS) Adding a whole directory tree to the repository =============================================== You can use "cvs import" to do this. Please clean up the tree to include only the relevant files. Then issue something like this: cvs -d /net/dazdak/cvsroot import papers/mypaper gph sfp03 (The two final arguments are "vendor" and "release" tags, probably irrelevant) This will import the *current directory and all descendents* into the repository, at papers/mypaper (i.e. a new top-level directory under your current directory). After import it's best to immediately do a checkout of the new directory. Then go into the newly checked-out directory and "cvs update NewDir" (or "cvs update -d") should check out working copies of the files you just added. The old directory, from where you imported the files, should not be needed anymore from that point on. Ignoring some files with a .cvsignore file ========================================== When you type "cvs update" in a directory, all the files that CVS doesn't know about are flagged with question marks. Sometimes, these will be ones that you want to add to the repository. Often, they are intermediate or easily re-created files. Typical examples: .dvi, .ps, .o, .class You'd rather not see all these ? files since it suggests something wrong with the working directory. So you can instruct CVS to ignore them. Some files (.o, editor backup files) are ignored by CVS as standard. Others you can ignore by adding their names (or wildcard matches) in a .cvsignore file in the directory, e.g. *.class (To avoid getting a ? for .cvsignore itself, you should add that to the repository). Files and permissions in CVS ============================ CVS is good with ordinary files, poor with directories, and hopeless with symbolic link. The important thing with directories is to put them in the right place to begin with. They're hard to move or delete after they're added. You can't add symlinks to a CVS repository at all: if you need them, make them with a Makefile or script. CVS notices and preserves the executable permission flag, but ignores absence of the writable flag. Only the owner's permissions are noticed. The executable flag tends to be sticky: please only add files as executable if they really need it. Summary of CVS commands ======================= (taken from "man cvs") cvs cvs checkout modules... A necessary preliminary for most cvs work: creates your private copy of the source for modules (named collections of source; you can also use a path rel- ative to the source repository here). You can work with this copy without interfering with others' work. At least one subdirectory level is always created. cvs update Execute this command from within your private source directory when you wish to update your copies of source files from changes that other developers have made to the source in the reposi- tory. cvs add file... Use this command to enroll new files in cvs records of your working directory. The files will be added to the repository the next time you run 'cvs commit'. Note: You should use the 'cvs import' command to bootstrap new sources into the source repository. 'cvs add' is only used for new files to an already checked-out module. cvs remove file... Use this command (after erasing any files listed) to declare that you wish to eliminate files from the repository. The removal does not affect others until you run 'cvs commit'. cvs commit file... Use this command when you wish to ''publish'' your changes to other developers, by incorporating them in the source repository. -- Original version by: David Aspinall 2002/05/30 Adapted for HW setup: Hans-Wolfgang Loidl 2002/07/04