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.
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
$ export CVSROOT=:pserver:anonymous@cvs.qref.sf.net:/cvsroot/qref $ cvs login $ cvs -z3 co qref
$ export CVSROOT=/var/lib/cvs
This is insecure but good for anonymous CVS:
$ export CVSROOT=:pserver:account@cvs.foobar.com:/var/lib/cvs $ cvs login
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
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
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
To get the latest version from CVS, use "tomorrow":
$ cvs ex -D tomorrow module_name
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 ...
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
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 filenamehive from a web page">