Title: Brief Introduction to Revision Control
1Brief Introduction to Revision Control
2Revision Control, also known asVersion 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
3Software 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
4Storing 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
5Delta 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
6Kinds of Changes Add, Delete Replace
- 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.
delete
replace
add
Example from http//www.itu.dk/courses/VOP/E2006/6
_Slides.pdf
7Diff Unix tool, gives difference between two
files.
- diff v1.txt v2.txt
- 4d3
- lt
- 10c9
- lt "Hello World")
- ---
- gt "Hello Version Control")
- 11a11
- gt Console.ReadLine()
Delete (d) line 4
Change (c) line 10
Add (a) line 11
8Master 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
Annes Version in Her Sandbox
Bobs Version in His Sandbox
Anne and Bob simultaneously change various files,
ideally different files.
9Check In, Check Out, etc.
x
z
y
Check Out (Lock)
Master Copies in Repository
Check In (Commit)
x
z
y
Local (Working) Copies in Sandbox
10CVS 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)
11Branches 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
12Conflicts
- 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.
13GIT 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