Setting up CVS
Jump to navigation
Jump to search
An Overview to Setting up and Using CVS
One of my old walk throughs...
SETTING UP A CVS SERVER ======================= 1. Need cvs on the system (/usr/bin/cvs) 2. Add cvspserver entry to /etc/services (if it is not there). cvspserver 2401/tcp # CVS client/server operations cvspserver 2401/udp # CVS client/server operations 3. Add cvpserver line to /etc/inetd.conf and restart inetd. cvspserver stream tcp nowait root /usr/bin/cvs cvs -f --allow-root=/home/cvsroot pserver 4. Make CVS home directory, /home/cvsroot, and set it up. # mkdir /home/cvsroot # cvs -d /home/cvsroot init # ls -lR .: total 1 drwxr-xr-x 3 plh raa 1024 Aug 30 12:09 CVSROOT CVSROOT: total 32 drwxrwxr-x 2 plh raa 1024 Aug 30 11:56 Emptydir -r--r--r-- 1 root root 493 Aug 30 12:09 checkoutlist -r--r--r-- 1 root root 692 Aug 30 12:09 checkoutlist,v -r--r--r-- 1 root root 760 Aug 30 12:09 commitinfo -r--r--r-- 1 root root 959 Aug 30 12:09 commitinfo,v -r--r--r-- 1 root root 364 Aug 30 12:09 config -r--r--r-- 1 root root 563 Aug 30 12:09 config,v -r--r--r-- 1 root root 753 Aug 30 12:09 cvswrappers -r--r--r-- 1 root root 952 Aug 30 12:09 cvswrappers,v -r--r--r-- 1 root root 1025 Aug 30 12:09 editinfo -r--r--r-- 1 root root 1224 Aug 30 12:09 editinfo,v -rw-rw-r-- 1 root root 0 Aug 30 12:09 history -r--r--r-- 1 root root 1141 Aug 30 12:09 loginfo -r--r--r-- 1 root root 1340 Aug 30 12:09 loginfo,v -r--r--r-- 1 root root 1151 Aug 30 12:09 modules -r--r--r-- 1 root root 1350 Aug 30 12:09 modules,v -r--r--r-- 1 root root 564 Aug 30 12:09 notify -r--r--r-- 1 root root 763 Aug 30 12:09 notify,v -r--r--r-- 1 root root 649 Aug 30 12:09 rcsinfo -r--r--r-- 1 root root 848 Aug 30 12:09 rcsinfo,v -r--r--r-- 1 root root 879 Aug 30 12:09 taginfo -r--r--r-- 1 root root 1078 Aug 30 12:09 taginfo,v -r--r--r-- 1 root root 1026 Aug 30 12:09 verifymsg -r--r--r-- 1 root root 1225 Aug 30 12:09 verifymsg,v CVSROOT/Emptydir: total 0 5. Add CVS environment variables to user profiles CVSROOT=:pserver:plh@gw.allwell.com.au:/home/cvsroot export CVSROOT # cd ~ # touch .cvspass 6. Test CVS login # . ./.bash_profile # cvs login 7. Now setup some files # mkdir tst # cd tst # mkdir doc # echo AAAA > doc/README # echo AAAA > tst.cfg # cvs import -m "Setup test project" tst tconf start N tst/tst.cfg cvs server: Importing /home/cvsroot/tst/doc N tst/doc/README No conflicts created by this import Note: tst is the directory of the project in the CVS repository tconf is the vendor tag start is the initial release tag I got a permissions problem if the target directory in the CVS repository did not already exist and was owned by me. Maybe this is because the cvs server is no running as root as it should and so was not able to create the files in the CVSHOME directory which was owned by root. 8. To add more files (and directories) to the project, use the following transcript as a guide. # cd tst # mkdir src # cd src # "main(){}" > main.c # cd .. # pwd /home/raa/plh/tst # ls doc src tst.cfg # cvs add src cvs add: in directory .: cvs [add aborted]: there is no version here; do 'cvs checkout' first Oops, I did this in the original source directory. I need to push this aside and check the project out of the CVS repository and *then* add the new files. # cd .. # mv tst tst.save Now check the 'tst' project out. # cvs co tst cvs server: Updating tst U tst/tst.cfg cvs server: Updating tst/doc U tst/doc/README # cd tst # cp -r ../tst.save/src . # ls CVS doc src tst.cfg Now add the new project elements: # cvs add src ? src/main.c Directory /home/cvsroot/tst/src added to the repository # cd src # ls CVS main.c # cvs add main.c cvs server: scheduling file `main.c' for addition cvs server: use 'cvs commit' to add this file permanently Now let's commit the changes: # cvs com cvs commit: Examining . cvs commit: Examining doc cvs commit: Examining src Get dropped into vi here to comment the commit... CVS: ---------------------------------------------------------------------- CVS: Enter Log. Lines beginning with `CVS:' are removed automatically CVS: CVS: Committing in . CVS: CVS: Added Files: CVS: src/main.c CVS: ---------------------------------------------------------------------- "/tmp/cvsAHDmhQ" 10 lines, 301 characters written ... RCS file: /home/cvsroot/tst/src/main.c,v done Checking in src/main.c; /home/cvsroot/tst/src/main.c,v <-- main.c initial revision: 1.1 done If you want to avoid using vi add '-m "Message..."' at the end of the commit command: # cvs com -m "Initial setup of src tree" ... 9. Once I have completed work on my copy of the project tree I should release it. # cd ~/tst # cvs release I can now either delete the project tree or leave it lying around in case I want to use it again in the future. 10. When I come back to do more work on the project tree later I can either do a CVS refresh on the tree (if I did not delete it) or check it out again (if I did delete it). 11. To remove files, I go to the location in the checked out project tree where the file of interest reside and remove it. Then I 'cvs remove' the file and commit the changes. # cd tst # cvs refresh # cd doc # rm bad.doc # cvs remove bad.doc # cvs -m "Demo remove" com To move project objects use a combination of CVS removes and adds. =============================================================================== 12. When you do a CVS update you will get a transcript like this: ? Blah... ? Blah... ? Blah... ? Blah... M Blah... P Blah... U Blah... C Blah... For example: ? devel/fix.prg ? grouping/rclbs.prg ? cvs.log ? grap.prg ? grapf.prg ? Page_7nx.prg U Page_7n.prg M pag_6_1.prg M page_6.prg M page_8.prg M studrep.prg R studrep2.prg U lib/set_lan3.prg U lib/set_lan4.prg U lib/set_lang.prg U lib/setlang2.prg P scan/xmenu.prg P scan/scantool/ra02/cionly.prg P scan/scantool/ra02/op_3.prg P scan/scantool/ra02/scanria.prg U utils/rclbs.prg These codes go something like this: P file ????? U file File Updated The file was brought up to date with respect to the repository. This is done for any file that exists in the repository but not in your source, and for files that you haven't changed but are not the most recent versions available in the repository. (plh's comment: You get this when a file in the repository but not your local copy is extracted into your local copy [updated?]). A file File Added to Repository (cvs add ...) The file has been added to your private copy of the sources, and will be added to the source repository when you run `cvs commit' on the file. This is a reminder to you that the file needs to be committed. R file File Removed (cvs remove ...) The file has been removed from your private copy of the sources, and will be removed from the source repository when you run `cvs commit' on the file. This is a reminder to you that the file needs to be committed. [Removed] M file Local copy Modified The file is modified in your working directory. `M' can indicate one of two states for a file you're working on: either there were no modifi- cations to the same file in the repository, so that your file remains as you last saw it; or there were modifications in the repository as well as in your copy, but they were merged suc- cessfully, without conflict, in your working directory. [local copy Modified] C file Conflict... A conflict was detected while trying to merge your changes to file with changes from the source repository. file (the copy in your work- ing directory) is now the result of merging the two versions; an unmodified copy of your file is also in your working directory, with the name `.#file.version', where version is the revision that your modified file started from. (Note that some systems automatically purge files that begin with `.#' if they have not been accessed for a few days. If you intend to keep a copy of your original file, it is a very good idea to rename it.) [Conflict] ? file file is in your working directory, but does not correspond to anything in the source repository, and is not in the list of files for cvs to ignore (see the description of the -I option). =============================================================================== Here is the transcript of a real import... cvs import -m "Initial import" library initial start + cvs import -m 'Initial import' library initial start N library/.htaccess N library/header.php N library/userform.html N library/processform.php cvs server: Importing /home/cvsroot/projects/pha/webdb/library/reports N library/reports/book_loan.php cvs server: Importing /home/cvsroot/projects/pha/webdb/library/request N library/request/form.php N library/request/action.php cvs server: Importing /home/cvsroot/projects/pha/webdb/library/search N library/search/index_collection.php N library/search/search.php cvs server: Importing /home/cvsroot/projects/pha/webdb/library/loan N library/loan/loan_list.php N library/publisher/action.php N library/publisher/form.php cvs server: Importing /home/cvsroot/projects/pha/webdb/library/db N library/db/.htaccess No conflicts created by this import =============================================================================== Here is the transcript of a checkout following this... xxx@yyy:~ > cvs co library + cvs co library cvs server: Updating library U library/.htaccess U library/corner.php U library/header.php U library/index.html U library/info.php U library/init.php U library/login_success.php U library/menu.php U library/pha-white.gif U library/processform.php U library/userform.html cvs server: Updating library/admin U library/admin/action.php U library/admin/form.php U library/admin/menu.php U library/admin/realaction.php U library/admin/realform.php U library/admin/realmenu.php cvs server: Updating library/author U library/author/action.php U library/author/form.php U library/author/list.new ------ plh@pha.com.au [30/08/2001]