Concurrent Version System (CVS) Doris Lee http://pyre.third-bit.com/gforge/presentations/cvs.ppt Email : ywlee@pyre.third-bit.com 12/1/2018
Agenda Introduction Useful Commands Tagging and Branching Case Studies Do and Don’t 12/1/2018
What is CVS? Why we need CVS? Dominant version control system Time machine Why we need CVS? Create a repository To coordinate code 12/1/2018
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 12/1/2018
Introduction (Cont’d) Keyword e.g. $Author$, $Name$, $Date$ $Author$ $Author : ywlee$ Created “CVS” Subdirectory Keyword – metadata about latest revision of file 12/1/2018
Useful Commands Command Usage: checkout - retrieve file(s) 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 12/1/2018
Note Binary file NO way to delete directories in CVS ! “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 12/1/2018
Tagging Marking a group of file revisions cvs tag Rel_1_beta File1.java Ver 1.1 Ver 1.2 Ver 1.3 File2.java Ver 1.1 : Ver 2.1 Ver 2.2 File3.java Ver 1.1 Ver 1.2 At a particular point of time 12/1/2018
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 12/1/2018
Case Study (1) 4 2 3 1 Alan Mary cvs update cvs commit cvs update 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 12/1/2018 Alan Mary
Case Study (2) 4 2 3 1 Mary Alan 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 12/1/2018
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 12/1/2018
Case Study (3) ! Test.txt(repository) Test.txt(sandbox) Blue Blue Yellow Orange ! Test.txt(sandbox) Blue Yellow Orange cvs diff Why? Tab and Spaces are different in CVS! 12/1/2018
Do and Don’t Do Don’t Check in only when files are stable 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 12/1/2018
References Books : Online : 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 12/1/2018
Question and Answer 12/1/2018