CS/CE 218 Lecture -*- Outline -*- connection: an important piece of supporting larger programs is version control: knowing what you shipped to a customer, and being able to retrieve it to verify bugs, etc. The ability to go back to old versions of a program is also useful because Unix doesn't do it for you automatically. It also helps when you want to make daring changes, since it gives you confidence to go back. * The Revision Control System (RCS) (see manual page rcsintro) advert: personal version of the SCCS system described in section 14.7 of Unix simpler, less industrial strength. Versions maintained (as in SCCS) without all the space that would be used by copies of them (idea is to store the differences from previous version). ** maintaining versions *** creation, check in (see manual page ci) draw a picture... you check in a version of a file by ci -l (ci = check in) ------------------ $ ci -l shpp.c shpp.c,v <-- shpp.c initial revision: 1.1 enter description, terminated with ^D or '.': NOTE: This is NOT the log message! >> Shell preprocessor >> main program >> . done ------------------- makes a file shpp.c,v, leaves you with shpp.c to work on more the -l option `locks' a copy for you for the first version, what it prompts you for is a description of the file, not why you changed it. after editing, you again use ci -l to check in another version -------------------- $ emacs shpp.c $ ci -l shpp.c shpp.c,v <-- shpp.c new revision: 1.2; previous revision: 1.1 enter log message: (terminate with ^D or single '.') >> Made includeonce insert file name in set >> before processing the file. >> . done -------------------- the log message is why you changed the file. ** getting old versions (see manual page co) co gets versions of the file ---------------------- $ co -r1.2 shpp.c shpp.c,v --> shpp.c revision 1.2 done ---------------------- If you already have shpp.c in your directory, get a prompt -------------------- $ co -r1.2 shpp.c shpp.c,v --> shpp.c revision 1.2 writable shpp.c exists; overwrite? [ny](n): n co warning: checkout aborted. $ co -r1.2 shpp.c shpp.c,v --> shpp.c revision 1.2 writable shpp.c exists; overwrite? [ny](n): y done -------------------- ** finding differences (see manual page rcsdiff) The rcsdiff program -------------------- $ rcsdiff -r1.1 shpp.c =================================================================== RCS file: shpp.c,v retrieving revision 1.1 diff -r1.1 shpp.c 1c1 < /* $Header: /usr/export/home/bambam/leavens/src/c/shpp/shpp.c,v 1.1 1991/10/28 06:20:37 leavens Exp $ */ --- > /* $Header: /usr/export/home/bambam/leavens/src/c/shpp/shpp.c,v 1.2 1991/10/28 06:21:40 leavens Exp leavens $ */ 105,107d104 < shpp(new_fp, prog_name); < fclose(new_fp); < 111a109,112 > > shpp(new_fp, prog_name); > fclose(new_fp); > -------------------- The output is the diff of version 1.1 and the current file ** recording information in programs *** in source files To get header with full path name as above /* $Header: /usr/export/home/bambam/leavens/src/c/shpp/shpp.c,v 1.1 1991/10/28 06:20:37 leavens Exp $ */ put this /* $Header$ */ in your program If you don't want the full path name, use /* $Id$ */ instead; then get: /* $Id: shpp.c,v 1.3 1991/10/28 06:30:04 leavens Exp leavens $ */ Note the time is UTC (Greenwich time) This works for makefiles too: # $Id$ the idea is a comment at the beginning of the line... # $Id: Makefile,v 1.1 1991/10/28 06:31:45 leavens Exp leavens $ see manual page for co for more details... *** in executables Want to be able to tell, from a customer's executable, what version it is (customer may not have the source). Idea, put Id information in strings in executable pay small cost in space on disk, but it won't be resident... in C ---------------- static char sccsid[] = "@(#)$Id$"; becomes... static char sccsid[] = "@(#)$Id: shpp.c,v 1.6 1991/10/30 15:18:23 leavens Exp leavens $"; ---------------- static so not interfering with other sccsids... *** extracting information from executable (man page for `what') but how to find it? Program what(1) looks for @(#) in program, prints rest of string ---------------- $ what bin/hp9000/shpp bin/hp9000/shpp: $Id: shpp.c,v 1.6 1991/10/30 15:18:23 leavens Exp leavens $ $Id: string_set.c,v 1.3 1991/10/30 15:18:23 leavens Exp leavens $ --------------