A quick’n'dirty CVS how-to
June 18th, 2004 18:22 by MartinThis will get you going:
Add to .bashrc on on the server where the cvs repository should be located:
export CVSROOT=$HOME/cvsroot
Make changes active:
source .bashrc
Of course, also make this directory:
mkdir ~/cvsroot
Register the repository:
cvs -d ~/cvsroot init
Add some project to the repository. For example, if you write a paper in LaTeX, and have alot of files in som dir (~/paper) including .log, .ps … do the following:
cd ~/paper
mkdir tmp
cp *.tex tmp
#cp (all other files to be included in the project) tmp
cd tmp
cvs import papername papername start
(yes, it says papername two times, the last is for the “vendor tag” which is required)
Remove the temporary folder:
cd ~/paper
rm -rf tmp
Your original paper folder should now be moved to backup, and as a first-timer, you should maybe make a ~/cvswork folder to work in and checkout from cvs:
mkdir ~/cvswork
cd ~/cvswork
cvs checkout papername
#cvs co papername #< - short for checkout
cd papername
emacs papername.tex
(write som breathtaking fantastic stuff and save)
Commit the changes back to the cvs repository:
cvs commit
Just keep the files in place, and the next morning get up to date with:
cd ~/cvswork/papername
cvs update
(Another reason for making a ~/cvswork directory is that i you have alot of projects in that folder, you can update them all by simply writing ‘cd ~/cdwork’ and cvs update’. This will update all projects).
Now, lets say you also have a laptop. Set it up according to this (of course, first set it up with ssh-keys to avoid annoying questions about your password…):
Add to your ~/.bashrc:
export CVSROOT=’username@your.server.com:/full/path/to/cvsroot’
export CVS_RSH=ssh
Make changes active:
source .bashrc
Make a ~/cvswork
mkdir ~/cvswork
Check out your project:
cd ~/cvswork
cvs co papername
cd papername
emacs papername.tex
Commit changes back to the repository on the server (IMPORTANT):
cvs commit
Add a file to your project by “cvs add filename”. For example, create a file ‘.cvsignore’ with the following content:
*.log
*.ps
put it in ~/cvswork/papername add it to your project:
cd ~/cvswork/papername
cvs add .cvsignore
cvs commit
If set up correctly, you should be able to do most cvs related stuff from within emacs, for example to commit/update, just press ‘C-x v v’ (vc-next-action)
Remember, if you add a complete directory to cvs, you should always do a ‘cvs co projectname’ in the parent directory to make it a real cvs workplace for emacs to recognize.