Marc Mosko Dec 18, 2001 Version 6 0 - Get the right version 1 - set your CVSROOT in .cshrc (bashrc, etc.) 2 - Create the CVSROOT directory 3 - determine your 'vendor tag'. 4 - Import your project. 5 - test it 6 - remove (or tar up, etc.) the original sources 7 - Work with the files as normal & check in 8 - How to use remotely over the Internet 9 - Use "cvs update" to keep a branch you've check out in sync. 10- How to "undo" changes 11- how to recover a removed file Very brief "how to" use CVS over the Internet. 0 - IMPORTANT: These apply to CVS version 1.11 or later. The version installed at UCSC is 1.9, and it's pretty broken. a) Ask UCSC to upgrade it or b) put /projects/ccrg/mmosko/local/bin in your path before /usr/local/bin and put /projects/ccrg/mmosko/local/lib in your LD_LIBRARY_PATH 1 - set your CVSROOT in .cshrc (bashrc, etc.) setenv CVSROOT /projects/ccrg/mmosko/code/CVS 2 - Create the CVSROOT directory You might want to create the file $CVSROOT/CVSROOT/history so enable logging of checkout/checkin/etc. You might also want to create a wrappers file to tell CVS to treat some files as binary. Very handy for imports. $CVSROOT/CVSROOT/cvswrappers *.tgz -m 'COPY' -k 'b' *.tar -m 'COPY' -k 'b' *.gz -m 'COPY' -k 'b' *.zip -m 'COPY' -k 'b' *.exe -m 'COPY' -k 'b' 3 - determine your 'vendor tag'. This will be attached to your projects. I use my name. 4 - Import your project. Below is an example for Glomosim. cd ~/ccrg/code/glomo make clean cvs import -m "Imported sources" marc/glomo glomo start The -m message is attached to the project description marc/glomo is the directory under CVSROOT marc is the vendor tag start is the release tag NOTE: this is recursive in to all subdirectories NOTE: I usually drop the "marc" part and just do an import like: cd ~/projx cvs import -m"Project X" projx projx start cd .. mv projx projx.old cvs co projx cd projx ... begin working ... 5 - test it cd .. mv glomo glomo.org cvs co marc/glomo diff -r marc/glomo glomo.org 6 - remove (or tar up, etc.) the original sources and no longer edit them. You should do all work in the CVS checkout directory. rm -rf glomo.org 7 - Work with the files as normal & check in cd ~/ccrg/code cvs co marc/glomo ... edit in marc/glomo .. cd ~/ccrg/code/marc/ cvs ci -R -m "test checkin" glomo You can also checkin single files, which can be faster. 8 - How to use remotely over the Internet On the remote system, be sure to set the environment variable CVS_RSH=ssh to use SSH. Using RSH is not secure. I have only tested this from my FreeBSD 4.3 box at home. Note that I also have setup an RSA password for my SSH at UCSC (see the ssh2 man page) This should work without the RSA key. For NT/98/etc., try looking at http://www.cvsgui.org/ssh.html for how to use WinCVS with a free SSH client. I've not tried it. ===== example ===== farpoint.tear.com% cvs -z9 -dmmosko@ermis.cse.ucsc.edu:/projects/ccrg/mmosko/code/CVS \ co marc/glomo Enter passphrase for RSA key 'marc@farpoint.tear.com': cvs server: Updating glomo U glomo/LICENSE U glomo/README U glomo/RELEASE_NOTES cvs server: Updating glomo/application U glomo/application/APPLICATION_README [snip] ============ edit some files, then check it in ===== example ===== cvs ci README Checking in README; /projects/ccrg/mmosko/code/CVS/glomo/README,v <-- README new revision: 1.3; previous revision: 1.2 done ============ Note that I did not need to tell CVS where the repository was (the big -d argument). It stored all that when I checked out the file. 9 - Use "cvs update" to keep a branch you've check out in sync. 10- How to "undo" changes taken from http://www.cvshome.org/docs/manual/cvs_5.html#SEC62 5.8 Merging differences between any two revisions With two `-j revision' flags, the update (and checkout) command can merge the differences between any two revisions into your working file. $ cvs update -j 1.5 -j 1.3 backend.c will undo all changes made between revision 1.3 and 1.5. Note the order of the revisions! If you try to use this option when operating on multiple files, remember that the numeric revisions will probably be very different between the various files. You almost always use symbolic tags rather than revision numbers when operating on multiple files. Specifying two `-j' options can also undo file removals or additions. For example, suppose you have a file named `file1' which existed as revision 1.1, and you then removed it (thus adding a dead revision 1.2). Now suppose you want to add it again, with the same contents it had previously. Here is how to do it: $ cvs update -j 1.2 -j 1.1 file1 U file1 $ cvs commit -m test Checking in file1; /tmp/cvs-sanity/cvsroot/first-dir/file1,v <-- file1 new revision: 1.3; previous revision: 1.2 done $ 11- Find the last revision with "cvs status $file" touch an empty $file cvs diff -N -r $rev $file | patch -R The last line creates the diff between the last version and the empty file. The "-R" option to patch tells it to reverse the sense of the diff (which goes from a full file to an empty file). You should then use "cvs add" to re-add the file and create any tags you want.