150 likes | 361 Views
Revision Control System (RCS). Author : Ya-Ling Wang and Quincy Wu Date : 2012/07/17. What is RCS. Revision Control System A kind of SCCS ( Source Code Control System ) Manage multiple revisions of files Some editors will keep the previous version for backup vim (:set backup)
E N D
Revision Control System(RCS) Author : Ya-Ling Wang and Quincy Wu Date : 2012/07/17
What is RCS • Revision Control System • A kind of SCCS (Source Code Control System) • Manage multiple revisions of files • Some editors will keep the previous version for backup • vim (:set backup) • You may manually save your programs as • hw-20120718-v1.c • hw-20120718-v2.c • hw-20120718-v3.c • hw-20120718-v4.c • This wastes the disk space because they may be 90% identical. • You are unable to see which is the version you need for a specific feature. • Support single-user and multiple-user
Keywords • Archive file • Keep all versions in one file (ex : test.c,v) • Check in ( ci )/ Check out ( co ) • Revision number • Default : 1.1 • Branch → • Log
Check in / Check out test.c test.c,v Check in Check out Check outwithout lock Check outwith lock ex.txt,v HW.sh,v ex.txt RCS HW.sh
Initialize • Where to save archive files? $ mkdir RCS Q: if there is no RCS/ Q: if there is rcs/ • Create and initialize a new RCS file $ rcs -i test.c RCS file: RCS/test.c,v enter description, terminated with single '.' or end of file: NOTE: This is NOT the log message! >> • Initial revision 1.1 • This creates test.c,v; you have to manually remove test.c • Actually, I prefer to initialize the RCS by simply checking in the source file. test.c RCS test.c,v
Check In • Check in to update archive file $ ci test.c RCS/test.c,v <-- test.c new revision: 1.5; previous revision: 1.4 enter log message, terminated with single '.' or end of file: >> • Check in and comment $ ci -m”comment” test.c # You may automatically check in the file at a specific time. $ at 1000 July 18ci -m“zone file on July 18” xxx.ncnu.info
Check Out • Check out from the archive file $ co test.c • Read only • If you want to modify the file, you have to lock it! $ co -l test.c • Only one user can lock at a time • If not the latest revision, which revision do you want? $ co -r1.2 test.c
Revisions Stored in the Archive File • Only the full text of the latest revision is stored. • The “difference” between revisions are included in the archive file so that you can restore older revisions.
Contents in the Archive File • Example • d = delete • a = add • d4 1 • Delete one line from line 4 • a5 1 • AAA • Add one line “AAA” from line 6 1.3 @Monday Tuesday Wednesday Thursday Friday Saturday Sunday @ 1.2 @ d3 1 a3 1 Thursday d6 2 @ 1.2 @Monday Tuesday Thursday Thursday Friday @
DEMO $ yum install rcs $ mkdir RCS $ vi test.c $ ci test.c >> description $ ls $ ls RCS $ co test.c # 1.1 $ ls -al $ co –l test.c # locked $ ls -al $ vi test.c $ ci test.c # 1.2 >> Comment $ co -l test.c; vi test.c $ ci -r2.0 test.c $ rlog test.c
Log Messages • rlog test.c RCS file: test.c,v Working file: test.c head: 1.3 branch: locks: strict access list: symbolic names: keyword substitution: kv total revisions: 3; selected revisions: 3 description: Introduction to Asterisk ---------------------------- revision 1.3 date: 2012/07/17 16:41:23; author: solomon; state: Exp; lines: +1 -1 Enhance the function added by Ya-Dong. ---------------------------- revision 1.2 date: 2012/07/17 16:40:33; author: winter; state: Exp; lines: +1 -0 Add one line ---------------------------- revision 1.1 date: 2012/07/17 16:38:41; author: solomon; state: Exp; Initial revision ---------------------------- GMT
Advanced Usage • RCS keywords • $Id$ • ident(1) • $Revision$ • /* * $Log$ */ • Compare RCS revision $ rcsdiff -r1.2 -r2.0 test.c • Default : latest revision & working file
Version Control Tools • Revision Control System ( RCS ) • Simple version control system on a single host • Concurrent Version System ( CVS ) • Used for team project development • Subversion ( SVN ) Windows/Linux • Include the revision control of directory • Git • Powerful (Fast, Easy, Distributed )
References • RCSINTRO(1) • Introduction to RCS • Linux HOWTO - Using RCS • The RCS Mini-HOWTO
Exercises • Please checkout revision 1.1 of this Archive file • How to compare different revisions in a file • Use “man rcsdiff” to learn what options are available. Choose one option to share with your labmates. • Please create the branches of P.3 • Download tree,v and execute “rlog tree,v” to show the revisions. • Try to create a similar file with several branches. • What will happened if there is no directory RCS or if there is a directory rcs?