Development Revision control CS 2204 Class meeting 8

  • Slides: 13
Download presentation
Development: Revision control CS 2204 Class meeting 8 (C) Doug Bowman, Virginia Tech, 2001

Development: Revision control CS 2204 Class meeting 8 (C) Doug Bowman, Virginia Tech, 2001

Overview of software development process n Creation of source files (. c, . h,

Overview of software development process n Creation of source files (. c, . h, . cpp) n n Compilation (e. g. *. c n n RCS, this week *. o) and linking gcc and make, last week Running and testing programs n gdb debugger, next week (C) Doug Bowman, Virginia Tech, 2001 2

What is revision control? n A way to ensure that edits on files are

What is revision control? n A way to ensure that edits on files are n n n Logged / archived Consistent Especially applicable when projects include n n Multiple files Multiple editors (developers) (C) Doug Bowman, Virginia Tech, 2001 3

Why do you need revision control? n n Software development projects are normally done

Why do you need revision control? n n Software development projects are normally done in teams Multiple people may be responsible for code in a single file You may want to freeze a working version and create a new revision branch You may want to roll back development to a previous point in time (C) Doug Bowman, Virginia Tech, 2001 4

Overview of RCS n n n Maintains complete revision information for a set of

Overview of RCS n n n Maintains complete revision information for a set of files (not limited to source code) Uses major and minor revision numbers (e. g. 1. 1, 2. 3) Supports locking files so that only one user can edit at a time Supports merging two edits of the same file Can automatically place revision information within the file itself (C) Doug Bowman, Virginia Tech, 2001 5

Key RCS commands n n n rcs (administer project) ci (check in file) co

Key RCS commands n n n rcs (administer project) ci (check in file) co (check out file) rlog (view the log) rcsdiff (see changes since last revision) For more, see UIAN ch. 19 (C) Doug Bowman, Virginia Tech, 2001 6

Basic RCS usage n n Create a subdirectory RCS of the directory containing the

Basic RCS usage n n Create a subdirectory RCS of the directory containing the files in question Check in the files to create an initial revision 1. 1 Check out and lock files to edit them Check files back in to create a new revision and allow others to edit them (C) Doug Bowman, Virginia Tech, 2001 7

Checking out files n n Assume we start with file main. c checked in

Checking out files n n Assume we start with file main. c checked in (RCS/main. c, v) co main. c n n Creates read-only file main. c in pwd co -l main. c n Creates writable file main. c in pwd n Locks file so others can’t check it out (C) Doug Bowman, Virginia Tech, 2001 8

Checking in files n n Assume we’ve locked and edited main. c ci main.

Checking in files n n Assume we’ve locked and edited main. c ci main. c n n n ci -u main. c n n n Creates a new revision (e. g. 1. 2) Removes main. c from pwd Creates a new revision Leaves read-only main. c in pwd ci -l main. c n n Creates a new revision (checkpoint) Allows you to keep editing (C) Doug Bowman, Virginia Tech, 2001 9

Setting the revision number n n Perhaps we’ve done major revisions to revision 1.

Setting the revision number n n Perhaps we’ve done major revisions to revision 1. 4 of main. c and we want to start a new branch (2) on the revision tree ci -r 2 main. c (C) Doug Bowman, Virginia Tech, 2001 10

Using keyword substitution n n Each time you check in a new revision, RCS

Using keyword substitution n n Each time you check in a new revision, RCS keeps information about the author, date/time, a log message (which you provide), etc. You can show this information in files by placing special tags within the files when setting up RCS (C) Doug Bowman, Virginia Tech, 2001 11

Keyword example /* * Last revision: $Revision$ by $Author$ on $Date$ * $Log$ */

Keyword example /* * Last revision: $Revision$ by $Author$ on $Date$ * $Log$ */ main() {. . . } /* * Last revision: $Revision: 1. 1 $ by $Author: bowman $ on $Date: 2001/10/10 20: 29: 27 $ * $Log: main. c, v $ * Revision 1. 1 2001/10/10 20: 29: 27 bowman * Initial revision * */ main() {. . . (C) Doug Bowman, Virginia Tech, 2001 } 12

RCS hints n n Usually use ci -u file to keep a read-only copy

RCS hints n n Usually use ci -u file to keep a read-only copy of file for compilation, etc. Use co -l -r. R file to retrieve revision number R of file instead of most recent revision (C) Doug Bowman, Virginia Tech, 2001 13