CVS uses a server/client style system (though the server doesn't run as a daemon, it is instantiated by the client).
Here's the basic rundown of the common commands you'll need to setup and use a cvs server.
First, I want to setup a CVS repository. The repository is where cvs will store all its information for the projects you'll be working on.
Let's say I'm going to have a repository in my home directory. I first make the directory and then initialize the directory as a cvs repository. If you do this correctly, the CVSROOT folder will show up in your repository folder.
Now that I have my repository, I can start a project. I want to write a text editor and I'm unoriginal, so I'm going to call it TextEdit. It's a project I've been working on, so all I have to do is add it to the repository. If you want to make a new project, you simple create the folder and use it for the import command. Note that you'll have to set the $CVSROOT environment variable before using the import command. I show the ZSH command on the example.
If you did this correctly, CVS should bring up your default text editor (I use VIM) and ask for a comment. Something witty might sound fun (and it is), but I should put something useful like "Imported TextEdit into CVS".
You can replace the first TextEdit with the folder to add and the second is the module name.
Finally, I can start working. First, I need to check out the module I just built:
Code:
asskoala@Faye asskoala % cvs co TextEdit [23:26:03 on 04/22/06]
cvs checkout: Updating TextEdit
Now, I want to add a file I made, text.c:
Code:
asskoala@Faye asskoala % cd TextEdit [23:27:27 on 04/22/06]
asskoala@Faye TextEdit % cat > text.c [23:27:29 on 04/22/06]
#include <stdio.h>
int main() {
return printf("Hello, World!\n");
}
asskoala@Faye TextEdit % cvs add text.c [23:27:52 on 04/22/06]
cvs add: scheduling file `text.c' for addition
cvs add: use 'cvs commit' to add this file permanently
asskoala@Faye TextEdit % cvs commit [23:27:58 on 04/22/06]
Again, a big text editor comes up asking you for a message: use something intelligent, despite the temptation to write something witty.
Now, let's say I want to add a binary file (like an image):
Code:
asskoala@Faye TextEdit % cvs add -kb blah.jpg [23:29:58 on 04/22/06]
cvs add: scheduling file `blah.jpg' for addition
cvs add: use 'cvs commit' to add this file permanently
asskoala@Faye TextEdit % cvs commit [23:30:05 on 04/22/06]
Same deal as above.
Now, let's say someone else has made changes and I want to update my repository:
The -d specifies recursively and -P specifics to prune empty directories (you can't delete directories in cvs).
Finally, removing something is easy too:
Code:
asskoala@Faye TextEdit % cvs remove blah.jpg [23:31:09 on 04/22/06]
cvs remove: file `blah.jpg' still in working directory
cvs remove: 1 file exists; remove it first
asskoala@Faye TextEdit % rm blah.jpg [23:31:59 on 04/22/06]
asskoala@Faye TextEdit % cvs remove blah.jpg [23:32:09 on 04/22/06]
cvs remove: scheduling `blah.jpg' for removal
cvs remove: use 'cvs commit' to remove this file permanently
asskoala@Faye TextEdit % cvs commit [23:32:10 on 04/22/06]
And that's all there is to it! The following pages detail installation of CVS as well as further reading for information on using CVS: however, this knowledge should simplify your further reading.