78
Concurrent Versions Concurrent Versions System ( System ( cvs cvs ) ) Speaker李政璋 Adviser廖元甫 老師 DateAugust 31, 2004

Concurrent Versions System (cvs)enlab07/CVS introduction.pdf · CVS features zCVS creates a file system that tracks each of the changes made by developers;including what was changed,

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

  • Concurrent Versions Concurrent Versions System (System (cvscvs))

    Speaker:李政璋Adviser:廖元甫 老師

    Date:August 31, 2004

  • Outline

    IntroductionFeatures of CVSBasic problemStep by step for WinCvsQ&ACVS setting

  • Why CVS?Has one of your project ever experienced like this?Which is the latest version? →version control

  • What is CVS?→ Concurrent version systems

    It’s like having your source files on a file server and

    coordinate with your colleagues on the version

    number you’re working on.

  • Client-server architecture

    client-server architecture

    no shared file systems

    Central Repository

  • Essential CVS Terminology

    RepositoryThe CVS server stores a copy of the software and data that the project has uploaded to that server. The server retains both themost recent version of each file and every historical version ofthe file (past changes).

    ModuleModules are alias names to projects kept in the repository and just the top level directories in the repository.

    Working copyThe copy of the data you get from the CVS server is called a "working copy".

    command

  • The CVS Repositoryewacvs:/home/cvsroot

    CVSROOT shr project1 project2 project3 devkits

    ar cgi doc install reports util web

    cgipr esapps formsunix nt

    • Resides on a server• No working files inside the repository

  • CVS featuresCVS creates a file system that tracks each of the changes made by developers;including what was changed, when it was changed, and who made the change.

    CVS ensures that the changes made by each developer do not accidentally overwrite changes made by other developers.

    All the files are edited outside of the repository and in some phase synchronized with the repository.

    Files are moved to, from and updated from repository with special tool called cvs, which is available for most platforms.

    CVS supports Binary files.

  • Revision numbersEvery file in a CVS repository can contain many versions, which are given version numbers in form x.y[.x.y[...]].

    The history of each file is tracked with an incrementing revision number.

    Revision numbers have the format 1.25 if they're on the main trunk, branches have something like 1.3.2.16

    For each revision there is a log entry.

  • Revision numbers

  • Concurrent checkoutMaster Repository

    foo.c

    WorkingCopyV1.7

    WorkingCopy V1.1

    WorkingCopy V1.2

    WorkingCopyV1.7

    WorkingCopy

    V1.2.2.1

    checkout branch rel_1_fix

    checko

    ut late

    st

    checkout latest

    checkoutV1.2

    checkoutV1.1Jack

    Mary JohnSundar

    X XV1.8 or 1.9V1.8 or 1.9

    V1.2.2.2

    checkin

    checkincheckin

    checkin prohibited

    Bob

  • Ideal casecheckoutdevelopmentcheckinupdate

    Developer A

    repository

    Developer B

  • Real caseCheck outdevelopmentCheck inupdateconflict resolution Developer A

    repository

    Developer B

    conflict

    X

  • CVS and the Development Cycle1. Check out source files in working directory.2. Edit source files.3. Unit test your code.4. Update working files to merge in changes from other

    developers (if necessary).5. Test again if the sources were merged on step 4.6. Commit changes.7. Repeat from step 2 until you have a new release.8. Tag the release.9. Submit the module name and release tag for integration

    build.

  • Preparation for using CVS

    Installing/Setting CVS ServerLinux cvs, cvsmalier, cvswebWindows cvsnt (not discussed here)

    Installing/Setting CVS ClientLinux

    cvs, gcvsWindows

    wincvs + cygwin (for ssh, optional but recommended) + diff

  • Setting up the clientsetting the environment variable

    - edit ~/.bash_profileusing “ssh” (recommended)

    # for cvsexport CVSROOT=:ext:user@hostname:/home/cvsrootexport CVS_RSH=sshexport CVSEDITOR=joe

  • Common commandscvs [cvs-options] command [command-options] [files]

    importImport sources into CVS

    statusShow status of checked out files

    checkoutCheckout sources for editing

    commitCheck files into the repository

    addAdd new file/directory to repository

  • Common commands

    removeRemove an entry from the repository

    updateBring working files into sync with repository

    diffShow differences between revisions

    tagLabel the sources

    log

    Show log messages for filesexport

    Export sources from CVSback

  • Wincvs:step by step1. Beginning to use2. Import3. Checkout4. Status5. Add/remove6. Rename 7. Modify8. Solve the conflict9. Checkout the past version10. Branch11. Keyword substitution

    command synonyms

    import im,imp

    status st,stat

    checkout co,get

    commit ci,com

    add ad,new

    remove rm,delete

    update up,upd

    diff di,dif

    tag ta,freeze

    log lo,rlog

    export ex,exp

  • WinCVS: Main screen

    file view

    status view

    modules

    stat

    e ic

    on

    revi

    sion

    num

    ber

    file

    type

    tag

    nam

    e

  • Beginning to use

  • Beginning to use

  • Import

  • Checkout

  • Status

  • AddAdd a new file or folder to the existing moduleThe “add” command is not recursiveThe “add” command just adds the file to the local working directory commitStep

    Create a new file or foldercvs addcvs commit

  • Add

  • Add

  • Add

  • RemoveRemove a file or folder from repositoryStep

    Remove a file(Delete)cvs removecvs commit

    Remove a folderDelete all file in the foldercvs removecvs commitcvs update -PDelete the folder

  • RenameStep

    Rename a fileRename in local directorycvs remove oldcvs add newcvs commit

    Rename a folderCreate a new foldercvs add new folderMove files in old to newcvs add files in newcvs commitcvs update

  • Rename

  • Renameremove

  • Renameadd

  • Rename

  • Rename

  • Modify

  • Modify commit

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Solve the conflict

  • Checkout the past versionBy tagBy timeBy revisionBy branch

    1 month ago2 hours ago400000 seconds agolast yearlast MondayYesterdaya fortnight ago3/31/92 10:00:07 PSTJanuary 23, 198710:05pm22:00 GMT

  • Checkout the past version

  • Checkout the past version

  • Checkout the past version

  • Checkout the past version

  • Tag

  • Create a branch

  • Create a branch

  • Create a branch

  • Create a branch

  • Create a branch

  • Create a branch

  • Graph

  • Graph

  • Keyword substitutionKeeping some kinds of information automatically up to date in your files.Example:

    $Revision$ → $Revision:1.5$

    $Date$ → $Date:1999/08/23 18:21:13$$Log$ → $Log:hello.c,v $ Revision 1.2.2.2 2004/08/22 08:20:13 skiesmodify work5_branch$$Id$… …

  • Keyword substitution

  • Source File Header for CVS

  • CVSweb

    Read-only web interface for CVS repositories Displaying each file's revision and diffs of different revisionsDownload from http://www.freebsd.org/projects/cvsweb.html

  • CVSweb:directory listing

  • CVSweb:history viewing

  • CVSweb:diff between two files

  • LinksOfficial CVS site:http://www.cvshome.org/WinCvs:http://www.wincvs.org/Cygwin:http://www.cygwin.com/Red-bean:http://cvsbook.red-bean.com/sourceforge:http://cvsgui.sourceforge.net/WinCVS via SSH:http://minimal.cx/wincvsssh.phpcvsmailer:http://raa.ruby-lang.org/list.rhtml?name=cvsmailercvsweb:http://www.freebsd.org/projects/cvsweb.html

    http://cvsbook.red-bean.com/http://cvsgui.sourceforge.net/http://minimal.cx/wincvsssh.phphttp://raa.ruby-lang.org/list.rhtml?name=cvsmailerhttp://www.freebsd.org/projects/cvsweb.html

  • Thank you!

    Q&A

  • Setting up the server

    1. Build the repository

    2. Add users to the cvs group3. Change the mode of /home/cvsroot4. Initialize the cvs

    $groupadd –g 500 cvs$adduser -u 1017 -g 500 cvsroot

    $cvs –d /home/cvsroot init

  • Setting up the server

    5. Confirm the port

    6. Restart xinetd

    7. Enjoy it!

    joe /etc/servicecvspserver 2401/tcp #CVS client/server operationscvspserver 2401/udp #CVS client/server operations

    /etc/rc.d/init.d/xinetd restart

  • CVSweb setting

    For cvsweb-2.05/61. Copy files

    2. Change mode

    cp cvsweb.conf /etc/httpd/conf/cp cvsweb.cgi /var/www/cgi-bin

    cd /var/www/cgi-bin/chmod a+x cvsweb.cgi

  • CVSweb setting3. Modify cvsweb.cgi (col:160)

    Ps.1st col:#!usr/bin/perl –wT delete “T”

    4. Modify cvsweb.conf(col:46)

    5. Check apache server

    for (“$mydir/cvsweb.conf”, ‘/etc/httpd/conf/cvsweb.conf’) {

    ‘local’ => [‘Local Repository’ , ‘/home/cvsroot’],

    /etc/rc.d/init.d/httpd start

  • CVSweb setting6. Check the web

    → http://hostname/cgi-bin/cvsweb.cgi7. Have fun!

  • CVSmail setting1. Refer to “README” of cvsmail.2. Modify “loginfo” file to add user’s E-mail addresses.

    3. Modify “notify” file for sending E-mail.

    4. Modify “config” file for lock file location.

    DEFAULT $CVSROOT/CVSROOT/loginfo.rb $CVSROOT $USER %s [email protected]

    ALL mail %s –s “CVS notification”

    LockDir = /var/lock/cvs

  • CVSmail setting5. Modify “acl” file for access control.

    # Define a group named "admin" which "john" and "peter" belong to.group:admin:liao,yrwang,ppsm,jjosm,sexmonster,leon

    # A group name followed by "@" can be specified in the list of users.group:staff:@admin,qtk,yjh,leon,sexmonster,undead,bombom,cctang,wende

    # Grant "admin" members everythinggrant:@admin:.*

    # Only staffs can commit on "www" modulegrant:@staff:HmmX|MAT4500|TCC300|Transcriber|MCDC|DialogX|SpeakerX

    Concurrent Versions System (cvs)OutlineWhy CVS?What is CVS?Client-server architectureEssential CVS TerminologyThe CVS RepositoryCVS featuresRevision numbersRevision numbersConcurrent checkoutIdeal caseReal caseCVS and the Development CyclePreparation for using CVSSetting up the clientCommon commandsCommon commandsWincvs:step by stepWinCVS: Main screenBeginning to useBeginning to useImportCheckoutStatusAddAddAddAddRemoveRenameRenameRenameRenameRenameRenameModifyModifySolve the conflictSolve the conflictSolve the conflictSolve the conflictSolve the conflictSolve the conflictSolve the conflictSolve the conflictSolve the conflictSolve the conflictCheckout the past versionCheckout the past versionCheckout the past versionCheckout the past versionCheckout the past versionTagCreate a branchCreate a branchCreate a branchCreate a branchCreate a branchCreate a branchGraphGraphKeyword substitutionKeyword substitutionSource File Header for CVSCVSwebCVSweb:directory listingCVSweb:history viewingCVSweb:diff between two filesLinksThank you!Setting up the serverSetting up the serverCVSweb settingCVSweb settingCVSweb settingCVSmail settingCVSmail setting