An Intro to Concurrent Versions System (CVS) - PowerPoint PPT Presentation

About This Presentation
Title:

An Intro to Concurrent Versions System (CVS)

Description:

is a version (or revision) control system. maintains entire history of source file ... Build early, build often (BEBO) Tag early, tag often ... – PowerPoint PPT presentation

Number of Views:149
Avg rating:3.0/5.0
Slides: 19
Provided by: cesCl
Learn more at: http://cecas.clemson.edu
Category:

less

Transcript and Presenter's Notes

Title: An Intro to Concurrent Versions System (CVS)


1
An Intro to Concurrent Versions System (CVS)
ECE 417/617Elements of Software Engineering
Stan Birchfield Clemson University
2
What is CVS?
  • CVS
  • is a version (or revision) control system
  • maintains entire history of source file (for
    each change who, when, and why)
  • is open-source and free (unlike SourceSafe)
  • What does it do?
  • stores entire history of each file efficiently
  • allows multiple people to work simultaneously
  • enables retrieval of old systems
  • helps to manage different versions, releases
  • works well over WAN (server/client)
  • works for any ASCII file, and limited support for
    binary
  • What is it not?
  • a build system
  • a substitute for management or communication

3
Why CVS?
  • Problem how to coordinate source file changes
    from multiple developers?
  • Solution 1 Manual merging and coordination
  • Solution 2 lock-modify-unlock (RCS, SCCS)
  • Solution 3 concurrent development (CVS)

4
How CVS manages changes
  • Scenarios
  • People work on different files ? trivial
  • People work on different parts of the same file ?
    CVS essentially runs diff
  • People work on the same part of the same file ?
    CVS alerts user, requires manual merging of
    changes

5
CVS model
Server (Unix/Linux)
Local machine (any O/S)
checkout, update, diff
Respository central, official copy, as well as
entire history
Local copy used for editing
add, remove, commit, tag
Note checkout is a one-time operation
6
CVS directory structure
Repository on server
Copy on local machine
/pub/cvsprojects/ece417 --CVSROOT (admin.
files) --3dmm -- data --
main.cpp,v -- database.cpp,v -- ui
-- MainFrame.cpp,v --
SettingsDlg.cpp,v --klt-ui
--bibtex-manager ...
C/user/me/mycode --CVS (admin. files)
--data -- CVS (admin. files) --
main.cpp -- database.cpp --ui -- CVS
(admin. files) -- MainFrame.cpp --
SettingsDlg.cpp
Note All information stored on a per-file basis
7
Pserver authentication
  • Each CVS command needs to authenticate you
  • Instead of a password for each command, first
    login
  • Steps
  • cvs login (server checks its passwd file if no
    passwd, then falls back to Unix system
    authentication)
  • now your password is stored locally in /.cvspass
  • local password is automatically used in the
    future as long as its there
  • CVS_PASSFILE can be used to change location of
    .cvspass
  • Note pserver authentication provides minimal
    security do NOT use an important password

8
CVS commands
  • Syntaxcvs goptions command coptions
    arguments
  • Examplecvs -d pserverme_at_cvs.ces.clemson.edu/p
    ub/cvsprojects/ece417 login
  • Common commands
  • cvs checkout modules create private copy
  • cvs update incorporate others changes into
    private copy
  • cvs add file add private file to repository
  • cvs remove file remove file from repository
  • cvs commit file publish changes to others
  • Customizing
  • .cvsrc file contains default options, both global
    and command-specific

9
Create / checkout module
  • To put a directory under CVS control,
  • cvs import m New file foo me start
  • All files in current directory are stored in foo
    subdirectory of repository
  • -m New file specifies the log comment
  • foo is directory name in repository
  • me is vendor tag (can be anything)
  • start is start tag (can be anything)
  • To checkout a directory,
  • cvs checkout foo
  • All files in foo subdirectory of repository are
    copied to current directory

10
Changing files
  • To add a file to the repository,
  • cvs add file takes effect at the next commit
  • To remove a file from the repository,
  • cvs remove file takes effect at the next commit
  • To commit changes youve made to a file,
  • cvs commit files
  • To tag a file revision,
  • cvs tag c MyProject-v1.0.0.0 files
  • (-c warns and aborts if source files are not
    up-to-date)

11
Bringing files up to date
  • To bring local files up to date,
  • cvs update
  • All files in current directory are updated using
    repository
  • For each file, prints one-letter code
  • U (update) your file has been updated with
    someones changes
  • M (merge) same, but you had made changes to the
    file, too
  • C (conflict) same, but CVS could not merge the
    changes
  • ? (unknown) file is not under CVS control
  • Note You cannot commit a file unless its
    up-to-date

12
Other useful commands
  • To get information about a file,
  • cvs status file
  • To examine a files log,
  • cvs log file
  • To see who made what change,
  • cvs annotate file

13
Conflicts
  • If two people modify the same part of a file,
    there is a conflict
  • CVS retains both sets of changes in the file,
    separated by ltltltlt (changes1) (changes2) gtgtgtgt
  • Example
  • main() ltltltltltltlt hello.c puts("Hello,
    World!") printf("Hello World")
    gtgtgtgtgtgtgt 1.2

14
Setting up server
  • Create a CVS repository if there is not already
    one
  • Add this to /etc/services cvs 2401/tcp remote
    cvs server
  • Add this to /etc/inetd.conf cvs stream tcp
    nowait root /path/to/cvs cvs pserver
  • Restart inetd
  • To encrypt password for CVSHOME/passwd file,
  • /usr/local/bin/perl -e 'print
    crypt("MyPassword","St") . "\n"
  • copy and paste into passwd file as nameepswd
  • To use RSH instead,use ext instead of pserver
    for CVSROOT. Might want to add set CVS_RSH to
    ssh which makes CVS use SSH and encryption for
    remote access.
  • Initialize CVS repository,
  • cvs d /usr/local/cvsrep init sets up CVSROOT
    directory

15
Versions and revisions
  • Each file has a unique revision number
  • Even number of dot-separated integers (start with
    1.1)
  • Successive revisions increment the rightmost
    number
  • Each branch has a unique branch number
  • Number appended to revision number
  • Correspond to user versions

16
Suggested CVS policies
  • Each file has an owner
  • You may
  • completely modify your own file (but dont
    change class interface)
  • make minor/obvious bug fixes to others files,
    but only if 100 confident (also notify them,
    just in case)
  • ask for permission before making bigger changes,
    or request the change from the developer
  • Alternative You are never allowed to modify
    anyone elses file
  • Good no chance of conflict
  • Bad extra overhead, not taking advantage of the
    C in CVS (might as well be using
    lock-modify-unlock)

17
Other suggestions
  • Make sure system clock reflects real time
  • Frequently update (stay in sync with repository)
  • Frequently commit changes (once compiled,
    completed, tested, reviewed)
  • Do NOT share code except via repository (e.g.,
    emails)
  • Build early, build often (BEBO)
  • Tag early, tag often
  • Save executables associated with tagged builds

18
Obtaining CVS
  • CvsGui (WinCVS/MacCvs,gCvs) http//www.wincvs.or
    gDownload and install this is a GUI front-end
    and also includes CVSCVS http//www.cvshome.org
    If you just want the command-line version
    documentation is here, too
Write a Comment
User Comments (0)
About PowerShow.com