[ previous ] [ Contents ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 10 ] [ 11 ] [ 12 ] [ 13 ] [ 14 ] [ 15 ] [ 16 ] [ A ] [ next ]

Debian reference
Chapter 12 - CVS


Check /usr/share/doc/cvs/html-cvsclient, /usr/share/doc/cvs/html-info, /usr/share/doc/cvsbook with lynx or run info cvs and man cvs for detailed information.


12.1 Install CVS server

The following setup will allow commits to the CVS repository only by a member of the "src" group, and administration of CVS only by a member of the "staff" group, thus reducing the chance of shooting oneself.

     # cd /var/lib; umask 002 ; sudo mkdir cvs # [WOODY] FSH
     # apt-get install cvs cvs-doc cvsbook
     # export CVSROOT=/var/lib/cvs
     # cd $CVSROOT
     # chown root:src .  # "staff" to restrict more for starting project.
     # chmod 3775 .             # If above uses "staff", use 2775
     # cvs -d /var/lib/cvs init # safer to specify -d here explicitly!
     # cd CVSROOT
     # chown -R root:staff .
     # chmod 2775 .
     # touch val-tags 
     # chmod 664 history val-tags
     # chown root:src history val-tags

12.2 CVS session examples


12.2.1 Anonymous CVS (download only)

     $ export CVSROOT=:pserver:anonymous@cvs.qref.sf.net:/cvsroot/qref
     $ cvs login
     $ cvs -z3 co qref

12.2.2 Use local CVS server

     $ export CVSROOT=/var/lib/cvs

12.2.3 Use remote CVS pserver

This is insecure but good for anonymous CVS:

     $ export CVSROOT=:pserver:account@cvs.foobar.com:/var/lib/cvs
     $ cvs login

12.2.4 Use remote CVS through ssh

You can also use RSA authentication (Connect with fewer passwords – RSAAuthentication, Section 9.5.3) which eliminates the password prompt.

     $ export CVSROOT=:ext:account@cvs.foobar.com:/var/lib/cvs

or for Sourceforge:

     $ export CVSROOT=:ext:account@cvs.qref.sf.net:/cvsroot/qref

12.2.5 Create a new CVS archive

For,

     ITEM              VALUE                    MEANING
     source tree:      ~/project-x              All source codes
     Project name:     project-x                Name for this project
     Vendor Tag:       Main-branch              Tag for the entire branch
     Release Tag:      Release-original         Tag for a specific release

Then,

     $ cd ~/project-x                 # dive into source directory
      ... create a source tree ...
     $ cvs import -m "Start project-x" project-x Main-branch Release-initial
     $ cd ..; rm -R ~/project-x

12.2.6 Work with CVS

To recall and work in local sources of project-x with CVS archive:

     $ cd                            # move to the work area.
     $ cvs co project-x              # get sources from CVS to local
     $ cd project-x
      ... make changes to the content ...
     $ cvs diff -u                   # similar to diff -u repository/ local/
     $ cvs ci -m "Describe change"   # save local sources to CVS
     $ vi newfile_added
     $ cvs add newfile_added
     $ cvs ci -m "Added newfile_added"
     $ cvs up                        # merge latest version from CVS
     $ cvs tag Release-1             # add release tag
     ... edit further ...
     $ cvs tag -d Release-1          # remove release tag
     $ cvs ci -m "more comments"
     $ cvs tag Release-1             # re-add release tag
     $ cd                            # move back to the work area.
     $ cvs co -r Release-initial -d old project-x 
     ... get original version to old directory
     $ cd old
     $ cvs tag -b Release-initial-bugfixes # create branch (-b) tag
      ... Now you can work on the old version
     $ cvs update -r Release-initial-bugfixes 
      ... Merge with others on the branch???
     $ cvs update -j Release-initial-bugfixes
      ... Merge into main trunk and fix conflicts
     $ cvs ci -m "merge Release-initial-bugfixes"
     $ cd
     $ tar -cvzf old-project-x.tar.gz old     # make archive, -j for bz2
     $ cvs release -d old               # remove local source (optional)

Nice options to remember (use right after cvs):

     -n      dry run, no effect
     -t      display messages showing steps of cvs activity

12.2.7 Export files from CVS

To get the latest version from CVS, use "tomorrow":

     $ cvs ex -D tomorrow module_name

12.2.8 Administer CVS

Add alias to a project (local server):

     $ su - admin           # a member of staff
     $ export CVSROOT=/var/lib/cvs ; cvs co CVSROOT/modules
     $ cd CVSROOT
     $ echo "px -a project-x" >>modules
     $ cvs ci -m "Now px is an alias for project-x"
     $ cvs release -d .
     $ exit                 # control-D to get back from su
     $ cvs co -d project px 
      ... check out project-x (alias:px) from CVS to directory project
     $ cd project
      ... make changes to the content ...

12.3 Troubleshooting CVS


12.3.1 File permissions in repository

CVS will not overwrite the current repository file but replaces it with another one. Thus, write permission to the repository directory is critical. For every new repository creation run the following to ensure this condition if needed.

     # cd /var/lib/cvs
     # chown -R root:src repository
     # chmod -R ug+rwX   repository
     # chmod    2775     repository  # if needed, this and subdirectory

12.3.2 Execution bit

A file's execution bit is retained when checked out. Whenever you see execution permission problems in checked-out files, change permissions of the file in the CVS repository with the following command.

     # chmod ugo-x filename
hive from a web page">