1 / 43

Managing Source Files CVS (Concurrent Versions System)

제 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

tia
Download Presentation

Managing Source Files CVS (Concurrent Versions System)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 제17강 : Managing Source Files CVS Managing Source Files CVS (Concurrent Versions System)

  2. 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 cdev.h bdev.h type.h file.c write.c sleep.c init.h flt.h mount.h nfs.c super.c win.c obj.h text.h abs.h ftp.c telet.c fill.c . . . . . . . .

  3. Typical Source Codes • src . . . . . dir1 dir2 dir3 dir4 Bob flash memory file.c file.c John Testing sys.h inode.h user.h driver.c stream.c hd.c vm.h file.h read.h intrp.c signal.c strategy.c cdev.h bdev.h type.h file.c write.c sleep.c init.h flt.h mount.h nfs.c super.c win.c obj.h text.h abs.h ftp.c telnet.c fill.c . . . . . . . . file,c file,c file.c Tom mpeg3 file.c file.c file.c file.c Peter booting file.c file.c

  4. Typical Source Codes • src . . . . . dir1 dir2 dir3 dir4 Bob flash memory John Testing sys.h inode.h user.h driver.c stream.c hd.c vm.h file.h read.h intrp.c signal.c strategy.c cdev.h bdev.h type.h file.c write.c sleep.c init.h flt.h mount.h nfs.c super.c win.c obj.h text.h abs.h ftp.c telnet.c fill.c . . . . . . . . Tom mpeg3 Peter booting

  5. Everybody makes copy of files 8000 files P men # of people P*8000 files

  6. Many Releases 8000 files P men 95 P*8000 8000 files P men P*8000 98

  7. Many people, Many Releases 8000 files P men 95 P*8000 8000 files P men P*8000 98 # of revisions P*R*8000 8000 files P men P*8000 00

  8. Number of Files to Manage word 1.1 (** 1st version is called “Baseline”) Revision (Replacement) word French word Russian word 1.2 word 1.3 Branch or Variation (Alternative – eg: for different Hardware’s, uses)

  9. 100*10*10*8000 80,000,000 files!  Many people, releases, branches 8000 files P men 95 P*8000 8000 files P men P*8000 98 P*R*B*8000 8000 files P men P*8000 00 # of branches

  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 Original Files Access Control History CVS System • 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) Repository Directory Master Source Check out Check in Check out Check in Private Directory Private Directory A’s Working Copy B’s Working Copy Edit File(s) Edit File(s)

  12. Original Files

  13. Original Files Repository A.c Files stored in repository become “master source” CVS CVS attaches extra info such as : access control info history version info ….

  14. Original Files Remove original files now. Afterwards, you can not simply “vi”. Always check out first, Then you can do vi Bob A.c Repository Check-out modify vi Access Control A.c CVS

  15. Bob vi Repository A.c < old > modify A.c Commit(Check-in) CVS A.c < new > System updates master copy records history version #

  16. Repository modify A.c Commit (Check-in) CVS A.c Later Print history undo …

  17. CVS Command Original Files Bob vi Repository (2) Checkout A.c • Import • (Make master copy • in repository) A.c modify CVS (3) Commit (Checkin) Bob vi A.c (4) History ...

  18. CVS Lab Exercise man cvs Make repository directory Create master source (import) Checkout Modify Commit (checkin)

  19. $HOME cvs_ex src Source Original Original source files are under …./src Example cd $HOME/cvs_ex ls src/ /*all source files are under src*/

  20. original source files home cvs_ex src my_dir1 my_dir2 Original Source

  21. $HOME cvs_ex src master Original Source Createrepository directory for future master source ** Make repository directory Make master source (import) Checkout Modify Commit (checkin) Example cd $HOME/cvs_ex ls src /*all source files are under src*/ cvs -d `pwd`/masterinit /*makerepository dir */ export CVSROOT=`pwd`/master /* register CVS repository in env. variable*/ ls $HOME/cvs_ex /*now you see the new directory master*/

  22. home cvs_ex src my_dir1 my_dir2 master Original Source creating repository directory

  23. $HOME cvs_ex src master s2 Original Source Master Source Create master source under repository directory Make repository directory ** Make master source (import) Checkout Modify Commit (checkin) System knows where the master file directory is . cd to src. Example cd $HOME/cvs_ex/src/* cd to original source file directory */ /* copy original src master */ cvsimport–m “s1” s2 s3 v1_1 message project vendor version (sub-tree) cd to master directory – new directory s2 created here ls -l s2/  see files with comma …? no write permission

  24. home cvs_ex src my_dir1 my_dir2 master s2 Original Source CVSROOT Master Source creating master source files

  25. home cvs_ex src my_dir1 my_dir2 master s2 Original Source CVSROOT Master Source after creating master source

  26. files created for bookkeeping

  27. home cvs_ex Check-out from master source to working directory src my_dir1 my_dir2 master s2 s2 Make repository directory Make master source (import) ** Checkout (copy all files) Modify Commit (checkin) My Source Master Source Example cd $HOME/cvs_ex/my_dir1 /* time to do coding here */ cvs checkout s2 /* copy files: give project name=s2*/ ls cd s2 ls -l System knows where the master file directory is. cd to my dir. Checkout. Run vi in my dir.

  28. home cvs_ex src my_dir1 my_dir2 master s2 s2 CVSROOT My source Master Source checkout

  29. home cvs_ex Modify file Commit src my_dir1 my_dir2 master s2 s2 Make repository directory Make master source (import) ** Checkout (copy all files) Modify Commit (checkin) My Source Master Source Example cd $HOME/cvs_ex/my_dir1 /* time to do coding here */ cd s2 vi test1.c /* modify file*/ cvs commit test1.c /* Commit. Give any message-to log*/ cvs log test1.c /*see history*/

  30. Multiple Developers -- Status -- = me master • 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 he me master he me master

  31. src Multiple Developersscenario: need patch master • 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 dir1 dir2 me he (2) (1) me he master

  32. Multiple Developersscenario: need merge • developer “he” • vi this.c; /* add printf(“two”); */ • cvs commit –m “add two” this.c • developer “me” • vi this.c; /* add printf(“one”); */ • cvscommit –m “add one” this.c • cvs status this.c  “status: Needs Merge …” • cvs update this.c  “Merging differences …” (2) (1) me he master

  33. manual merge me master • cvs update this.c Merging differences … warning: conflicts during merge in this.c this.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

  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”) Revision (Replacement) D3 D1 D2 word 1.2 English French Russian word 1.3 Branch or Variation (Alternative – eg: for different Hardware’s, uses)

  36. Branches • cd dir1 • cvs tagrelease-1  tag all files gives symbolic name to files • cvs checkout-rrelease-1 s2 •  now this release-1 is our new base. copy from this release. NOT from newest version all subsequent commits go to release-1 master release-1

  37. Branches • To create new branch from this version cvs rtag -b -rrelease-1release-1-patches project_name another new branch • To get a working copy cvs checkout -rrelease-1-patches project_name master release-1 create new branch from this version new branch

  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 CASE IDE

  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 dir modified files only or specified version only • log view history

  41. misc • SCCS AT&T, Bell Lab (Source Code Control System) • RCS lock/unlock open source code single host • CVS client/serverenvironment network, multi-user (do CVS after telnet) copy/merge If 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”)

More Related