130 likes | 236 Views
Brief Introduction to Revision Control. Ric Holt. Revision Control , also known as: Version Control or SCM = Source Control Management. Management of changes to documents, programs, and other information stored as computer files.
E N D
Revision Control, also known as:Version Control orSCM = Source Control Management Management of changes to documents, programs, and other information stored as computer files. Each changed file (or set of files) is called a version or a revision. These are often numbered, e.g., version 12.6.2. A release is made available to users. http://en.wikipedia.org/wiki/Revision_control
Software for SCM • (Related: CMS: Content Management System) • SCCS = Source Code Control System • Obsolete as of 1995 • Predecessor to RCS • RCS = Revision Control System • By Walter Tichy, 1980s • Keeps track of evolving versions = revision control • Single user • CVS = Concurrent Versions System • By Dick Grune, 1980s • Based on RCS, but multi-user • Subversion = free “better” CVS • GIT • By Linus Torvalds, 2005 • Distributed revision control – no central version • All “branches” are complete
Storing Successive Versions of a File • Each change to a file is stored as the “diff” from its previous version • Saves space, avoids full copy of each version • Less important now that file space is check
Delta = Difference Between Files • Forward delta = How to change file F to its next version (store file F, compute next versions) • Backward delta = How to change file G to its previous (store file G, compute previous versions) Forward Delta File F File G Backward Delta
1. using System; 2. using System.Collections.Generic; 3. using System.Text; 4. 5. class Program 6. { 7. static void Main(string[] args) 8. { 9. Console.WriteLine( 10. "Hello World"); 11. // comment 12. } 13. } 1. using System; 2. using System.Collections.Generic; 3. using System.Text; 4. class Program 5. { 6. static void Main(string[] args) 7. { 8. Console.WriteLine( 9. "Hello Version Control"); 10. // comment 11. Console.ReadLine(); 12. } 13. } Kinds of Changes: Add, Delete & Replace delete replace add Example from http://www.itu.dk/courses/VOP/E2006/6_Slides.pdf
Diff: Unix tool, gives difference between two files. $ diff v1.txt v2.txt 4d3 < 10c9 < "Hello World"); --- > "Hello Version Control"); 11a11 > Console.ReadLine(); Delete (d) line 4 Change (c) line 10 Add (a) line 11
Master Version & Working (Sandbox) Versions System consisting of files x, y and z is being developed. x z y Master Version in Repository x x z z y y Anne’s Version in Her Sandbox Bob’s Version in His Sandbox Anne and Bob simultaneously change various files, ideally different files.
Check In, Check Out, etc. x z Check Out (Lock) y Master Copies in Repository Check In (Commit) x z y Local (Working) Copies in Sandbox
CVS Operations • Check out - Lock set of files (get copies) • Commit (check in) - Use your checked out copies to update the repository • Update - Using central repository, get fresh copies • Add - Signal that a local file is to be added to repository (upon commit)
Branches & Merges • A branch is a new stream of development, e.g., Version 8.0 of a data base (new version of V7.0) • As bugs are found in V7.0, these need to be merged into V8.0 (and vice versa) • Merges can be very tricky and slow to carry out
Conflicts • Ideally, no two people try to update the same file at the same time. • If they do, and they changed different parts of the file, the changes are • MERGED • If they do, and they have changed the same parts of a file, there is a • CONFLICT • Generally conflicts are fixed manually.
GIT: A Fast Version Control System • Invented by Linus Torvalds • GIT • Is distributed --- no master copy • Is controversial • Safeguards against corruption • Has fast merges • Scales up • Convenient tools still being built