Starting out with CVS
As often as I use CVS, I can never remember how to start a new project from an existing code base. Invariably, I look in the man pages and on the web, and read through several pages to get what I want. Here is the way to do it.
The goal here is to take some existing code, put it under source control, and then set it up so you can begin checking it back in. We import, delete, then check out to do this:
The example uses a project called “rs232″
Make sure $CVSROOT is set:
$ echo $CVSROOT
/export/home/CVS
(if not, set it, then “cvs init”)
Get into the directory with the code:
$ pwd
/export/home/sean/rs232
$ ls
Makefile rs232.asm rs232-poll.asm
Import the code into CVS:
$ cvs import rs232 VENDOR HEAD
You’ll be prompted to make a comment, I usually use “Initial import”
You’ll then see the files being created (the ‘N’ at the left column)
"/tmp/cvsY0a2zz" 5L, 244C written
N rs232/Makefile
N rs232/rs232-poll.asm
N rs232/rs232.asm
No conflicts created by this import
So, now the CVS repository is created:
$ ls -l $CVSROOT/rs232
total 16
-r--r--r-- 1 sean users 530 Nov 3 08:27 Makefile,v
-r--r--r-- 1 sean users 6347 Nov 3 08:27 rs232.asm,v
-r--r--r-- 1 sean users 3799 Nov 3 08:27 rs232-poll.asm,v
Since I’d like to continue editing the code where it is, delete the working directory and check it out (or, we could have moved the original files to a tempdir)
$ cd ..
$ rm -rf rs232/
$ cvs co rs232
cvs checkout: Updating rs232
U rs232/Makefile
U rs232/rs232-poll.asm
U rs232/rs232.asm
$ cd rs232
$ ls
CVS Makefile rs232.asm rs232-poll.asm
Make your changes, then use cvs ci to check in.