Upload
tia
View
97
Download
0
Embed Size (px)
DESCRIPTION
제 17 강 : Managing Source Files CVS. Managing Source Files CVS (Concurrent Versions System). Typical Source Codes. src. dir1. dir2. dir3. dir4. sys.h inode.h user.h driver.c stream.c hd.c vm.h file.h read.h intrp.c signal.c strategy.c - PowerPoint PPT Presentation
Citation preview
1
ManagingSource Files
CVS (Concurrent Versions System)
제 17 강 : Managing Source Files CVS
2
src
dir1 dir4dir3dir2
sys.h inode.h user.h driver.c stream.c hd.cvm.h file.h read.h intrp.c signal.c strategy.ccdev.h bdev.h type.h file.c write.c sleep.cinit.h flt.h mount.h nfs.c super.c win.cobj.h text.h abs.h ftp.c telet.c fill.c . . . . . . . .
. . . . .
Typical Source Codes
3
src
dir1 dir4dir3dir2
sys.h inode.h user.h driver.c stream.c hd.cvm.h file.h read.h intrp.c signal.c strategy.ccdev.h bdev.h type.h file.c write.c sleep.cinit.h flt.h mount.h nfs.c super.c win.cobj.h text.h abs.h ftp.c telnet.c fill.c . . . . . . . .
. . . . .
Typical Source Codes
file.c
file,c
file.c
file.c
Bobflash memory
JohnTesting
Tommpeg3
Peterbooting
file.c
file,cfile.c
file.cfile.cfile.c
file.c
4
src
dir1 dir4dir3dir2
sys.h inode.h user.h driver.c stream.c hd.cvm.h file.h read.h intrp.c signal.c strategy.ccdev.h bdev.h type.h file.c write.c sleep.cinit.h flt.h mount.h nfs.c super.c win.cobj.h text.h abs.h ftp.c telnet.c fill.c . . . . . . . .
. . . . .
Typical Source Codes
Bobflash memory
JohnTesting
Tommpeg3
Peterbooting
5
Everybody makes copy of files
8000 files P men
# of people P*8000 files
6
Many Releases
95
98
8000 files P men P*8000
8000 files P men
P*8000
7
Many people, Many Releases
# of revisions
95
98
00
8000 files P men P*8000
8000 files P men
P*8000
8000 files P men P*8000
P*R*8000
8
Number of Files to Manage
word 1.1 (** 1st version is called “Baseline”)
Branch or Variation (Alternative – eg: for different Hardware’s, uses)
Revis
ion
(Rep
lacem
en
t)
wordFrench
wordRussianword 1.2
word 1.3
9
Many people, releases, branches
# of branches
95
98
00
8000 files P men
P*8000
8000 files P men
P*8000
8000 files P men
P*8000
P*R*B*8000
100*10*10*8000
80,000,000 files!
10
Typical System • Situation:
– m persons, p files – concurrent/independent work
• Access Control: anyone update any file?
• Concurrent Update: two work on same file?
• History/undo: who/file/action/date/
11
Terminology
• Repository Directory– Place where master source is stored
• Check-out– Take a copy of file(s) from master source
• Commit (Check-in)– local change master source
• Revision– Each change to a file
• Project– Collection of files (tree name)
Master Source
A’s Working Copy
Repository Directory
Private Directory
Access ControlHistory
B’s Working Copy
Private Directory
Edit File(s)
Original Files
Edit File(s)
Check out Check in
Check out Check in
CVS System
12
Original Files
13
A.c
CVS
Repository
Original Files
CVS attaches extra info such as : access control info history version info ….
Files stored in repositorybecome “master source”
14
A.c
CVS
A.cRepositoryBob Check-out
modify vi
Remove original files now.Afterwards, you can not simply “vi”.Always check out first,Then you can do vi
Access Control
Original Files
15
A.c
CVS
A.c
A.c
RepositoryBob vi
Commit(Check-in)
modify
< old >
< new >
System updates master copy records history version #
16
A.c
CVS
A.c
Repository
Commit(Check-in)
modify
LaterPrint history
undo…
17
A.c
CVS
A.c
A.c
RepositoryBob vi
Bob vi
(1) Import (Make master copy
in repository)
(3) Commit (Checkin)
(2) Checkout
(4) History ...
CVS Command
modify
Original Files
18
CVS Lab Exercise
Make repository directoryCreate master source (import)
CheckoutModify
Commit (checkin)
man cvs
19
Examplecd $HOME/cvs_exls src/ /*all source files are under src*/
Original source files are under …./src
$HOME
cvs_ex
src
SourceOriginal
20
original source files
home
cvs_ex
src my_dir1 my_dir2
OriginalSource
21
Examplecd $HOME/cvs_exls src /*all source files are under src*/
cvs -d `pwd`/master init /* make repository dir */
export CVSROOT=`pwd`/master /* register CVS repository in env. variable*/
ls $HOME/cvs_ex /*now you see the new directory master*/
Create repository directory for future master source
** Make repository directoryMake master source (import)
CheckoutModify
Commit (checkin)
$HOME
cvs_ex
src master
OriginalSource
22
creating repository directory
home
cvs_ex
src my_dir1 my_dir2 master
OriginalSource
23
Examplecd $HOME/cvs_ex/src /* cd to original source file directory */
/* copy original src master */cvs import –m “s1” s2 s3 v1_1
message project vendor version (sub-tree)
cd to master directory – new directory s2 created herels -l s2/ see files with comma …? no write permission
Create master source under repository directory
Make repository directory** Make master source (import)
CheckoutModify
Commit (checkin)
System knows where the master file directory is . cd to src.
$HOME
cvs_ex
src master
s2OriginalSource
MasterSource
24
creating master source files
home
cvs_ex
src my_dir1 my_dir2 master
OriginalSource s2
MasterSource
CVSROOT
25
after creating master source
home
cvs_ex
src my_dir1 my_dir2 master
OriginalSource s2
MasterSource
CVSROOT
26
files created for bookkeeping
27
Examplecd $HOME/cvs_ex/my_dir1 /* time to do coding here */
cvs checkout s2 /* copy files: give project name=s2*/ lscd s2ls -l
Check-out from master source to working directory
Make repository directoryMake master source (import)** Checkout (copy all files)
ModifyCommit (checkin)
System knows where the master file directory is. cd to my dir. Checkout. Run vi in my dir.
home
cvs_ex
src my_dir1 my_dir2 master
s2MasterSource
s2My
Source
28
checkout
home
cvs_ex
src my_dir1 my_dir2 master
s2MasterSource
CVSROOTs2My
source
29
Examplecd $HOME/cvs_ex/my_dir1 /* time to do coding here */
cd s2vi test1.c /* modify file*/cvs commit test1.c /* Commit. Give any message-to log*/
cvs log test1.c /*see history*/
Modify fileCommit
Make repository directoryMake master source (import)** Checkout (copy all files)
ModifyCommit (checkin)
home
cvs_ex
src my_dir1 my_dir2 master
s2MasterSource
s2My
Source
30
Multiple Developers -- Status --
• Up to date– My file = master copy in the repository (latest version)
• Locally Modified– I edited, not committed my changes to master copy
yet
• Needs Patch– he committed newer version to master copy – (my copy is not modified yet)– What is his modification?
• Needs Merge– I made modification, – he also committed newer version to master copy
me master
me master
me master
me master
he
he
=
31
Multiple Developersscenario: need patch
• developer “me”– cvs checkout s2 at dir1
• developer “he”– cvs checkout s2 at dir2– vi this.c; – cvs commit –m “add two” this.c
• “his” change is not reflected in dir1 yet• developer “me” cvs update this.c
dir2
master
dir1
src
me he
me master he(1)(2)
32
• developer “he”– vi this.c; /* add printf(“two”); */– cvs commit –m “add two” this.c
• developer “me”– vi this.c; /* add printf(“one”); */– cvs commit –m “add one” this.c– cvs status this.c “status: Needs Merge …”– cvs update this.c “Merging differences …”
me master
Multiple Developersscenario: need merge
he(1)(2)
33
manual merge• cvs update this.c
Merging differences …warning: conflicts during merge in this.cthis.c: void test()
{ <<<<<<<< this.c
printf(“one”); developer-1’s code=======printf(“two”); developer-2’s code
>>>>>>>> }
• Fix them manually. Delete {>>>, <<<, = = =}• cvs commit this.c
me master
34
add/remove files
• to add files – create new files in working directory– cvs add filename cvs commit
filename
• to remove files– remove files from working directory
(rm …)– cvs remove filename cvs commit
filename
35
Managing Branches
word 1.1 (** 1st version is called “Baseline”)
Branch or Variation (Alternative – eg: for different Hardware’s, uses)
Revis
ion
(Rep
lacem
en
t) Frenc
hRussian
word 1.2
word 1.3
D1 D2 D3
English
36
Branches• cd dir1• cvs tag release-1
tag all files gives symbolic name to files• cvs checkout -r release-1 s2• now this release-1 is our new
base. copy from this release.
NOT from newest version all subsequent commits go to
release-1master release-1
37
Branches• To create new branch from this version
cvs rtag -b -r release-1 release-1-patches project_name
another new branch
• To get a working copy cvs checkout -r release-1-patches
project_namemaster release-1
new branch
create new branchfrom this version
38
merge (branch & main tree)
• First release the patched version– cd – cvs release -d project_name
• To merge release-1 & release-1-patches– cvs checkout -j release-1-patches project_name
• To commit all files changed by merge of release-1-patch
into source tree– cvs commit -m “merged”
39
Versions
• MRF (Modification Request Form)• Change control authority–approves
DB• Change tracking authority
– CVS administrator – Check out, modify, Unit test, other
tests– lint, coverage, review …DB
IDE
CASE
40
CVS command arguments
• init create repository directory• import plain source --> repository cvs files
• checkout repository --> my working directory• commit my working dir --> repository
memorize modification,versioning
• update repository --> my working dirmodified files only or specified version only
• log view history
41
misc• SCCS AT&T, Bell Lab (Source Code Control
System)
• RCS lock/unlockopen source code
single host• CVS client/server environment network, multi-user (do CVS after telnet)
copy/mergeIf conflict:
CVS requests hand-editing to resolve conflict
Notify service :via email if file(s) are modified by
others.
42
Bonsai (ctags continued)• Basically, a tree control• Web-based tool for watching the up-to-the-minute goings-on in CVS (Concurrent Versions System) repository• Allows queries on the contents of a CVS archive
– get a list of checkins– see what checkins have been made
• by a given person,• given CVS branch, • in a particular time period
43
(Cont’d)
• Also includes tools for :– looking at checkin logs (and comments)– doing diffs between various versions of a file– finding out what person is responsible for
changing a particular line of code(“cvsblame”)