160 likes | 213 Vues
Concurrent Version System (CVS). Doris Lee http://pyre.third-bit.com/gforge/presentations/cvs.ppt Email : ywlee@pyre.third-bit.com. Agenda. Introduction Useful Commands Tagging and Branching Case Studies Do and Don’t. What is CVS?. Dominant version control system Time machine.
E N D
Concurrent Version System (CVS) Doris Lee http://pyre.third-bit.com/gforge/presentations/cvs.ppt Email : ywlee@pyre.third-bit.com
Agenda • Introduction • Useful Commands • Tagging and Branching • Case Studies • Do and Don’t
What is CVS? • Dominant version control system • Time machine Why we need CVS? • Create a repository • To coordinate code
Introduction • Setup : download software and set the environment variables • CVSROOT • CVS_RSH • Files in the repository • All program source files • All non-code project artifacts • Exclude files that can be reconstituted easily
Introduction (Cont’d) • Keyword e.g. $Author$, $Name$, $Date$ • $Author$ $Author : ywlee$ • Created “CVS” Subdirectory
Useful Commands • Command Usage: • cvs [cvs-options] command [command-options-and-arguments] • checkout - retrieve file(s) • add - add file(s) to repository • update - download changes • commit - upload changes • diff - view differences • log - display log info
Note • Binary file “cvs add TextFile” vs “cvs add -kb BinaryFile” • NO way to delete directories in CVS ! • Sticky Bit - when checkout old version of file • impact : can’t overwrite current version at repository
Tagging • Marking a group of file revisions cvs tag Rel_1_beta File3.java Ver 1.1 Ver 1.2 File1.java Ver 1.1 Ver 1.2 Ver 1.3 File2.java Ver 1.1 : Ver 2.1 Ver 2.2
Branching • Branch : a fork of the repository • experimental work, release, or bug fixing cvs rtag –b BR_1 projectName 2.6.2.1 BR_1 Trunk 2.5 2.6 2.7 2.8
Case Study (1) 4 2 cvs update cvs commit cvs update cvs commit Test.java revision 1.1 : Total+=amount; : Test.java revision 1.1 : Total+=amount; : if (amount > 10) { Total+=amount; } : - new revision: 1.2 done Total++; 3 1 - Merging differences between 1.1 and 1.2 into Test.java - new revision: 1.3 done Alan Mary
Case Study (2) 4 2 cvs update cvs commit cvs update Test.java revision 1.1 : Total+=amount; : Test.java revision 1.1 : Total+=amount; : Total+=subtotal; Total+=tax; - new revision: 1.2 done 3 1 - Merging differences between 1.1 and 1.2 into Test.java -rcsmerge: warning: conflicts during merge - cvs update:conflicts found Mary Alan
Case Study (2) (cont’d) • Resolve conflicts by communications, and • I) if the repository is the correct one, • Remove local copy and do update • II) if different codes are preferred, • Edit the code <<<<<< Test.java Total+=subtotal; ========= Total+=tax; >>>>>> • III) cvs commit
Case Study (3) • cvs diff • Why? Test.txt(repository) Blue Yellow Orange Test.txt(sandbox) Blue Yellow Orange ! ! ! Tab and Spaces are different in CVS!
Do and Don’t • Do • Enter meaningful comments • Check in only when files are stable • “cvs update” before “cvs commit” • Don’t • Change files in the ‘CVS’ subdirectory • Change or create files in repository directly • Change layout of a shared file
References • Books : • Pragmatic Version Control Using CVS by David Thomas • Essential CVS by Jennifer Vesperman • Online : • http://www.cvshome.org/docs/manual/ • CSC207, CSC408 websites • man pages