CVS for Beginners

First rule: NEVER GIVE UP!
It took me almost 4 hours to try my hands at first CVS-thingie.
After all the sweat and tears, finally I managed to install a cvs server, add a repository (which contains infamous stubborn BINARY files), and check out a project from the repository.
Pheww!

Install the server

You might want to play expert by trying to install it from the source. I'd say DON'T. Remember you're a beginner and a beginner shouldn't be exposed to the hassles of compiling source codes.
Try using an installer (linux *.rpm files) instead. It's easier and faster.

When you're done try to check where the cvs is installed.
Type:

$which cvs

The directory in which the cvs is installed should show up.

Set an enviroment variables $CVSROOT to hold the path to the directory where your CVS repository is located. For example, I make a new directory /usr/cvsroot.

It is best to configure it in your /etc/profile. This way, you make a system-wide configuration Just edit it and add two lines like below.

CVSROOT="/usr/cvsroot"
export CVSROOT


Try using the old vi to do that. It's fun. For the old time sake.

Initialize cvsroot directory

Type:

$cvs -d /usr/cvsroot init


CVS will format /usr/cvsroot, adding a new subdirectory CVSROOT and some administrative files.

The next step is crucial. I'll tell you why.
CVS, by default, handles only source codes, which is treated like ordinary plain text files. You should tell CVS to handle several kind of files as binary files. If you forget this step, binary files will be treated like ordinary text files and, to make the story short, your work will be a great disaster.

What are binary files, you ask? Any files you can't read in a plain text editor. *.exe, *.jar, *.gif, and *.jpeg files are some of them. When you're working on a java project, jar files are sure something you can't miss. So be careful when importing files or folders to your CVS repository.

To tell CVS how to handle non-binary files, try edit cvswrappers. In this file, located within CVSROOT subdirectory, specify files or types of file CVS should treat as binary.
So add

*.jar -k 'b' -m 'COPY'
*.exe -k 'b' -m 'COPY'
*.gif -k 'b' -m 'COPY'


Add more according to your need. 'b' means 'binary'. When CVS try to copy the files, CVS will understand that those files are binary. -m 'COPY' means CVS will choose copy strategy when executing a merge action.

Now you're ready to copy a folder to CVS repository.
Work from within the source folder. When I want to copy folder /home/umar/workflow, I try

$cd /home/umar/workflow

and then

$cvs import -m "first workflow repository" workflow intercitra workflow_0_1

The phrase within quotation marks is tag to mark a repository.
workflow is a folder relative within CVSROOT in which you'd like to save the repository.
Change intercitra into your own company name or vendor name.
Then change workflow_0_1 into your own versioning.

You'll be glad when you this notification.

No conflicts created by this import.


When you do, congratulations! Your glass will be half-full.

Check the repository from Eclipse

Try checkout a java project from a cvs repository into your Eclipse.
Select new > Project > CVS
Fill in server name and others to make a new repository location.
Click next and pick out the module you'd like to check out.
Click next and pick out which type of the repository you want to download: HEAD (or trunk), BRANCH, or a tagged module.
Click next and pick into which project you'd like to perform this download.


Note:
When you choose 'New Java Project Wizard' another dialog window would show up. Select 'Java Project' (not CVS) and do the rest as usual.


When downloading is done, Eclipse might show some error signs. Just cleanup this new project's configuration. You might want to try project properties and specify where java source code is located and add jars from lib folder and stuffs.

Several useful links
http://www.cs.columbia.edu/~hgs/cvs/
http://www.fluidthoughts.com/howto/cvs/

Comments

Anonymous said…
nita: hmmm postingannya bermanfaat juga nih....bisa dipake klo mau belajar cvs:)
btw layout nya berubah tuh *maybe u didn't notice it* coba dicek lagi...
Duuude... you're succumbing to the Dark Side of Talking Things We Laypeople Don't Understand. Nyuk. But it's nice to know you still write.
Chezumar said…
nita: Thanks, I've made a minor adjustment. It seems that the problem only occured on IE.

fool: I should've put a large banner on top of the post 'NOT RECOMMENDED FOR NON-GEEKS'.

Popular Posts