Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Debian GNU/Linux Reference Guide
Prev Home Next

12.1.2 CVS session examples

The following will set up shell environments for CVS repository access. Anonymous CVS (download only)

Read-only remote access:

     $ export CVSROOT=:pserver:[email protected]:/cvsroot/qref
     $ cvs login
     $ cvs -z3 co qref Use local CVS server

Local access from a shell on the same machine:

     $ export CVSROOT=/var/lib/cvs Use remote CVS pserver

Remote access without SSH (use RSH protocol capability in cvs):

     $ export CVSROOT=:pserver:[email protected]:/var/lib/cvs
     $ cvs login

This is prone to eavesdropping attack. Use remote CVS through ssh

Remote access with SSH:

     $ export CVSROOT=:ext:[email protected]:/var/lib/cvs

or for SourceForge:

     $ export CVSROOT=:ext:[email protected]:/cvsroot/qref

You can also use RSA authentication (Connecting with fewer passwords – RSA, Section 9.5.3), which eliminates the password prompt. Create a new CVS archive


     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-initial     Tag for a specific release


     $ 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 Work with CVS

To work with project-x using the local CVS repository:

     $ 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 up -C modified_file       # undo changes to a file
     $ 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
      ... to create all newly created subdirectories from CVS, use 
      ... "cvs up -d -P" instead
      ... watch out for lines starting with "C filename"
      ... unmodified code is moved to `.#filename.version'
      ... search for "<<<<<<<" and ">>>>>>>" in filename
     $ 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 (Tag=sticky)
     $ cvs update -d -P              # don't create empty directories
      ... source tree now has sticky tag "Release-initial-bugfixes"
      ... work on this branch
     $ cvs up -d -P # sync with files modified by others on this branch
     $ cvs ci -m "check into this branch"
     $ cvs update -kk -A -d -P
      ... remove sticky tag and forget contents
      ... update from main trunk without keyword expansion
     $ cvs update -kk -d -P -j Release-initial-bugfixes
      ... Merge from Release-initial-bugfixes branch into the main 
      ... trunk without keyword expansion.  Fix conflicts with editor.
     $ 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 as first argument(s) to cvs):

     -n      dry run, no effect
     -t      display messages showing steps of cvs activity Export files from CVS

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

     $ cvs ex -D tomorrow module_name 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                 # or Ctrl-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 ...

Debian GNU/Linux Reference Guide
Prev Home Next

  Published under the terms of the GNU General Public License Design by Interspire