revision control system (rcs)

15
1 TAC2000/2000.7 Protocol Engineering and Application Research Laboratory (PEARL) Revision Control System (RCS) Author : Ya-Ling Wang and Author : Ya-Ling Wang and Quincy Wu Quincy Wu Date : 2012/07/17 Date : 2012/07/17

Upload: trygg

Post on 11-Jan-2016

50 views

Category:

Documents


1 download

DESCRIPTION

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) - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Revision Control System (RCS)

11 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Revision Control System(RCS)

Author : Ya-Ling Wang and Author : Ya-Ling Wang and Quincy WuQuincy Wu

Date : 2012/07/17Date : 2012/07/17

Page 2: Revision Control System (RCS)

22 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

What is RCS Revision Control SystemRevision Control System

A kind of SCCS (A kind of SCCS (Source Code Control System))

Manage multiple revisions of filesManage multiple revisions of files Some editors will keep the previous version for backupSome editors will keep the previous version for backup

vim (:set backup)vim (:set backup)

You may manually save your programs asYou may manually save your programs as hw-20120718-v1.chw-20120718-v1.c hw-20120718-v2.chw-20120718-v2.c hw-20120718-v3.chw-20120718-v3.c hw-20120718-v4.chw-20120718-v4.c

This wastes the disk space because they may be 90% identical.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.You are unable to see which is the version you need for a specific feature.

Support single-user and multiple-userSupport single-user and multiple-user

Page 3: Revision Control System (RCS)

33 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Keywords Archive fileArchive file

Keep all versions in one file (ex : Keep all versions in one file (ex : test.ctest.c,v,v))

Check in ( ci )Check in ( ci ) / Check out ( co )/ Check out ( co ) Revision numberRevision number

Default : 1.1Default : 1.1

BranchBranch → → LogLog

Page 4: Revision Control System (RCS)

44 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Check in / Check out

Check out

test.c

RCS

test.c,vCheck in

Check out with lock

Check out without lock

ex.txt

HW.sh

ex.txt,v HW.sh,v

Page 5: Revision Control System (RCS)

55 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Initialize Where to save archive files?Where to save archive files?

$ mkdir RCS$ mkdir RCS

Q: if there is no RCS/Q: if there is no RCS/

Q: if there is rcs/Q: if there is rcs/ Create and initialize a new RCS fileCreate and initialize a new RCS file

$ rcs -i test.c$ rcs -i test.c

RCS file: RCS/test.c,vRCS file: RCS/test.c,v

enter description, terminated with single '.' or end of file:enter description, terminated with single '.' or end of file:

NOTE: This is NOT the log message!NOTE: This is NOT the log message!

>>>> Initial revision 1.1Initial revision 1.1

This creates test.c,v; you have to manually remove test.cThis 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.Actually, I prefer to initialize the RCS by simply checking in the source file.

RCS test.c,v

test.c

Page 6: Revision Control System (RCS)

66 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Check In Check in to update archive fileCheck in to update archive file

$ ci test.c$ ci test.cRCS/test.c,v <-- test.cRCS/test.c,v <-- test.c

new revision: 1.5; previous revision: 1.4new revision: 1.5; previous revision: 1.4

enter log message, terminated with single '.' or end of file:enter log message, terminated with single '.' or end of file:

>>>>

Check in and commentCheck in and comment$ ci -m”comment” test.c$ ci -m”comment” test.c

# You may automatically check in the file at a specific time.# You may automatically check in the file at a specific time.

$ at 1000 July 18$ at 1000 July 18ci -m“zone file on July 18” xxx.ncnu.infoci -m“zone file on July 18” xxx.ncnu.info

Page 7: Revision Control System (RCS)

77 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Check Out Check out from the archive fileCheck out from the archive file

$ co test.c$ co test.c Read onlyRead only

If you want to modify the file, you have to lock it!If you want to modify the file, you have to lock it!$ co -l test.c$ co -l test.c Only one user can lock at a timeOnly one user can lock at a time

If not the latest revision, which revision do you want?If not the latest revision, which revision do you want?$ co -r1.2 test.c$ co -r1.2 test.c

Page 8: Revision Control System (RCS)

88 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Revisions Stored in the Archive File

Only the full text of the Only the full text of the latest revision is stored.latest revision is stored.

The “difference” The “difference” between revisions are between revisions are included in the archive included in the archive file so that you can file so that you can restore older revisions.restore older revisions.

1.1 1.2 1.3

Monday Monday Monday

Tuesday Tuesday Tuesday

Thursday Thursday Wednesday

Friday Thursday Thursday

AAA Friday Friday

Saturday

Sundy

Page 9: Revision Control System (RCS)

99 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Contents in the Archive File Example d = deleted = delete a = adda = add d4 1d4 1

Delete one line from line 4Delete one line from line 4

a5 1a5 1 AAAAAA

Add one line “AAA” from line 6Add one line “AAA” from line 6

1.3@Monday Tuesday Wednesday Thursday Friday Saturday Sunday @

1.2 @Monday Tuesday Thursday Thursday Friday @

1.2 @d3 1 a3 1 Thursday d6 2 @

Page 10: Revision Control System (RCS)

1010 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

DEMO

$ yum install rcs$ yum install rcs

$ mkdir RCS$ mkdir RCS

$ vi test.c$ vi test.c

$ ci test.c$ ci test.c

>> description>> description

$ ls$ ls

$ ls RCS$ ls RCS

$ co test.c$ co test.c # 1.1# 1.1

$ ls -al$ ls -al

$ co –l test.c$ co –l test.c # locked# locked

$ ls -al$ ls -al

$ vi test.c$ vi test.c

$ ci test.c$ ci test.c # 1.2# 1.2

>> Comment>> Comment

$ co -l test.c; vi test.c$ co -l test.c; vi test.c

$ ci $ ci -r2.0 -r2.0 test.ctest.c

$ rlog test.c$ rlog test.c

Page 11: Revision Control System (RCS)

1111 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Log Messages

rlog test.crlog test.cRCS file: test.c,vRCS file: test.c,v

Working file: test.cWorking file: test.c

head: 1.3head: 1.3

branch:branch:

locks: strictlocks: strict

access list:access list:

symbolic names:symbolic names:

keyword substitution: kvkeyword substitution: kv

total revisions: 3; selected revisions: 3total revisions: 3; selected revisions: 3

description:description:

Introduction to AsteriskIntroduction to Asterisk

--------------------------------------------------------

revision 1.3revision 1.3

date: 2012/07/17 16:41:23; author: date: 2012/07/17 16:41:23; author: solomonsolomon; state: Exp; lines: +1 -1; state: Exp; lines: +1 -1

Enhance the function added by Ya-Dong.Enhance the function added by Ya-Dong.

--------------------------------------------------------

revision 1.2revision 1.2

date: 2012/07/17 16:40:33; author: date: 2012/07/17 16:40:33; author: winterwinter; state: Exp; lines: +1 -0; state: Exp; lines: +1 -0

Add one lineAdd one line

--------------------------------------------------------

revision 1.1revision 1.1

date: 2012/07/17 16:38:41; author: date: 2012/07/17 16:38:41; author: solomonsolomon; state: ; state: Exp;;

Initial revisionInitial revision

--------------------------------------------------------

GMT

Page 12: Revision Control System (RCS)

1212 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Advanced Usage RCS keywordsRCS keywords

$Id$$Id$ ident(1)ident(1)

$Revision$$Revision$ /*/*

* $Log$ * $Log$ */ */

Compare RCS revisionCompare RCS revision$ rcsdiff -r1.2 -r2.0 test.c$ rcsdiff -r1.2 -r2.0 test.c Default : latest revision & working fileDefault : latest revision & working file

Page 13: Revision Control System (RCS)

1313 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Version Control Tools Revision Control System ( RCS )Revision Control System ( RCS )

Simple version control system on a single hostSimple version control system on a single host

Concurrent Version System ( Concurrent Version System ( CVS ) ) Used for team project developmentUsed for team project development

Subversion ( Subversion ( SVN ) Windows/Linux ) Windows/Linux Include the revision control of directoryInclude the revision control of directory

Git Powerful (Fast, Easy, Distributed )Powerful (Fast, Easy, Distributed )

Page 14: Revision Control System (RCS)

1414 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

References RCSINTRO(1) Introduction to RCS Introduction to RCS Linux HOWTO - Using RCSLinux HOWTO - Using RCS The RCS Mini-HOWTOThe RCS Mini-HOWTO

Page 15: Revision Control System (RCS)

1515 TAC2000/2000.7

Protocol Engineering and Application Research Laboratory (PEARL)

Exercises Please checkout revision 1.1 of this Archive filePlease checkout revision 1.1 of this Archive file How to compare different revisions in a fileHow to compare different revisions in a file

Use “man rcsdiff” to learn what options are available. Choose one option Use “man rcsdiff” to learn what options are available. Choose one option to share with your labmates.to share with your labmates.

Please create the branches of P.3Please create the branches of P.3 Download tree,v and execute “Download tree,v and execute “rlog tree,vrlog tree,v” to show the revisions.” to show the revisions. Try to create a similar file with several branches.Try to create a similar file with several branches.

What will happened if there is no directory RCS or if there is a What will happened if there is no directory RCS or if there is a directory rcs?directory rcs?