8/8/2019 2. Version Control
1/52
Version ControlLecturer: Ng Huy Bin
8/8/2019 2. Version Control
2/52
Books And Reading
There is no course textbook. Here are some useful books:
Version Control with Subversion By Ben Collins-Sussman, Brian W.
Fitzpatrick, C. Michael Pilato, 2004
Subversion Version Control: Using The Subversion Version Control
System in Development Projects By William Nagel, 2005 Visual SourceSafe 2005 Software Configuration Management in
Practice By Alexandru Serban, 2007
Essential CVS By Jennifer Vesperman, 2006
8/8/2019 2. Version Control
3/52
Working Together "Hey, Jane, could you send me a copy of those changes
you made last Tuesday?" "Bob, this function doesn't work anymore. Did you change
something?
"Sorry, I can't seem to find those old classes. I guessyou'll just have to re-implement them.
"Ok, we've all been working hard for the last week. Now
let's integrate everyone's work together."
Where did my code go?Who overwrote my code?
Why did you overwrite my
code?
and...
When was the last time we
backed up the code?
When did fileXlast
change?
What changed in the file?
Why was the file
changed?
and...
Who changed the file?
8/8/2019 2. Version Control
4/52
The Repository
The repository stores information in the form of afilesystemtreea typical hierarchy of files and directories. Any number
ofclients connect to the repository, and then read or write to
these files.
Typically server/client architecture.
8/8/2019 2. Version Control
5/52
Working Copy
Users work on a copy, the
Working Copy
The version control
system managesthe synchronization
between repository
and working copies
States
Unchanged, and current
Locally changed, and current
Unchanged, and out-of-date
Locally changed, and out-of-date
8/8/2019 2. Version Control
6/52
Workspaces
An area where users can work separated from the repository and to isolateeach user from the others.
Working folder
Working directory
Sandbox
View
Enlistment
8/8/2019 2. Version Control
7/52
Revision
The repository'sfilesystem
Revisions
Revision Numbers
Revision Keywords
HEAD
BASE, COMMITTED, PREV
Revision Dates
{2009-03-19}
{2008-02-17 15:30}
Mixed Revision
Working Copies
Updates and Commits
are SeparateGlobal Revision Numbers
calc/Makefile:4
integer.c:4
button.c:4
calc/Makefile:4
integer.c:4
button.c:5
calc/Makefile:6
integer.c:6
button.c:6
8/8/2019 2. Version Control
8/52
Deltas
The difference between the two revisions is called a delta.
Forward Deltas
Reverse Deltas
8/8/2019 2. Version Control
9/52
CheckOut/Update
To get a resource from the repository with thepurpose of making changes to it
A patchfileis a special file that can be usedby the patchutility to update a set of filesfrom one revision to another.
8/8/2019 2. Version Control
10/52
Modify/Edit
To make changes to the resources in our
workspace
8/8/2019 2. Version Control
11/52
Check In/Commit
To save changes to the repository
Atomic commitsensures thatwhile one person is committing
changes to the repository, noone else can.
A hookis a place to hang ascript, such that the script isrun at a specific stage of the
version controlprocessperhaps before or aftera change is committed, when alog message is stored, or whena file is checked out forexclusive development.
8/8/2019 2. Version Control
12/52
Conflict
8/8/2019 2. Version Control
13/52
Lock Modify Unlock
8/8/2019 2. Version Control
14/52
Lock Modify Unlock (cont.)
8/8/2019 2. Version Control
15/52
Copy Modify Merge
Automatic mergeManual merge
To combine changes of 2 working copies to one
working copy
8/8/2019 2. Version Control
16/52
Branch
A branch is a line ofdevelopment that exists
independently of another line.
Starting repository
layout Repository with new copy
The branching of one file's history
A codeline represents a project's
development evolution across time, having a
continuous history.
8/8/2019 2. Version Control
17/52
Merging Branches
To integrate changesperformed in one
branch into another
branch.
8/8/2019 2. Version Control
18/52
Tag/Label
A tag (label) is
just a snapshot of
a project in time.
8/8/2019 2. Version Control
19/52
Exclusive Development
The version control system permits only one user at a time to work on any individualfile.
8/8/2019 2. Version Control
20/52
Simultaneous DevelopmentMultiple users can work on the same file and the version control system attempts
to merge the respective changes seamlessly.
8/8/2019 2. Version Control
21/52
Central Repository
Central repository
The historic data about project changes isstored in a single place.
CentralRepository
User
User
User
User
Data export Anexported set of data
should not containadministrative files ordata for the versioncontrol system.
8/8/2019 2. Version Control
22/52
Distributed Repositories
Distributed Repositories
Each developer has a personal repository, and therepositories update from their peers.
Repository
RepositoryRepository
User
User User
8/8/2019 2. Version Control
23/52
8/8/2019 2. Version Control
24/52
Remote Access To The Repository
8/8/2019 2. Version Control
25/52
Benefits
Any stored revision of a file can be retrieved,viewed, and changed.
The differences between any two revisions can
be displayed.
Patches can be created automatically.
Multiple developers can work simultaneously on
the same project or file without overwriting oneanother's changes.
The project can be branched to allow
simultaneous development along varied tracks.
These branches can be merged back into the main
line of development.
Distributed development is supported acrosslarge or small networks.
Any version control
is better than no
version control.
8/8/2019 2. Version Control
26/52
8/8/2019 2. Version Control
27/52
Tools
VSS (http://msdn.microsoft.com/en-us/vs2005/aa718670.aspx )
CVS (http://www.nongnu.org/cvs/)
SVN (http://subversion.tigris.org/)
Perforce (http://www.perforce.com/perforce/products.html)
BitKeeper (http://www.bitkeeper.com/Products.html) Accurev (http://www.accurev.com/accurev.html)
ClearCase (http://www-306.ibm.com/software/awdtools/clearcase/ )
CM Synergy (http://www.telelogic.com/corp/products/synergy/index.cfm)
StarTeam (http://www.borland.com/us/products/starteam/index.html )
MKS Integrity (http://www.mks.com/products/index.jsp)
Vault (http://www.sourcegear.com/vault/)
http://msdn.microsoft.com/en-us/vs2005/aa718670.aspxhttp://www.nongnu.org/cvs/http://subversion.tigris.org/http://www.perforce.com/perforce/products.htmlhttp://www.bitkeeper.com/Products.htmlhttp://www.accurev.com/accurev.htmlhttp://www-306.ibm.com/software/awdtools/clearcase/http://www.telelogic.com/corp/products/synergy/index.cfmhttp://www.borland.com/us/products/starteam/index.htmlhttp://www.mks.com/products/index.jsphttp://www.sourcegear.com/vault/http://www.sourcegear.com/vault/http://www.mks.com/products/index.jsphttp://www.borland.com/us/products/starteam/index.htmlhttp://www.telelogic.com/corp/products/synergy/index.cfmhttp://www-306.ibm.com/software/awdtools/clearcase/http://www-306.ibm.com/software/awdtools/clearcase/http://www-306.ibm.com/software/awdtools/clearcase/http://www.accurev.com/accurev.htmlhttp://www.bitkeeper.com/Products.htmlhttp://www.perforce.com/perforce/products.htmlhttp://subversion.tigris.org/http://www.nongnu.org/cvs/http://msdn.microsoft.com/en-us/vs2005/aa718670.aspxhttp://msdn.microsoft.com/en-us/vs2005/aa718670.aspxhttp://msdn.microsoft.com/en-us/vs2005/aa718670.aspx8/8/2019 2. Version Control
28/52
Comparing Version Control
Systems
VCS Development model Repository type Atomic commits
CVSSimultaneous or
exclusiveCentral and proxied No
Bitkeeper Simultaneous Distributed Yes
ClearCaseSimultaneous or
exclusiveCentral or distributed N/A
Git Simultaneous Distributed Yes
GNU Arch Simultaneous Distributed Yes
Perforce Simultaneous orexclusive
Central Yes
SubversionSimultaneous or
exclusiveCentral Yes
Visual Source Safe Exclusive Central No
8/8/2019 2. Version Control
29/52
http://www.open.collab.net/downloads/subversion/
http://www.open.collab.net/downloads/subversion/http://www.open.collab.net/downloads/subversion/8/8/2019 2. Version Control
30/52
CollabNet Subversion Installation
8/8/2019 2. Version Control
31/52
CollabNet Subversion Installation
(cont.)
8/8/2019 2. Version Control
32/52
Creating Repository
8/8/2019 2. Version Control
33/52
Creating Repository (cont.)
8/8/2019 2. Version Control
34/52
Commit
8/8/2019 2. Version Control
35/52
Update
8/8/2019 2. Version Control
36/52
Controlling Access To The
Repository
8/8/2019 2. Version Control
37/52
httpd.conf
8/8/2019 2. Version Control
38/52
Lock
8/8/2019 2. Version Control
39/52
Add/Delete
8/8/2019 2. Version Control
40/52
Revision
8/8/2019 2. Version Control
41/52
Diff/Revert/CleanUp
8/8/2019 2. Version Control
42/52
Resolving Conflicts
8/8/2019 2. Version Control
43/52
Resolved
8/8/2019 2. Version Control
44/52
Create Tag/Branch
8/8/2019 2. Version Control
45/52
Working With Branch
8/8/2019 2. Version Control
46/52
Merging A Branch Into Trunk
M i A B h I t T k
8/8/2019 2. Version Control
47/52
Merging A Branch Into Trunk
(cont.)
8/8/2019 2. Version Control
48/52
GUI Client
8/8/2019 2. Version Control
49/52
Using GUI Client
8/8/2019 2. Version Control
50/52
Using GUI Client (cont.)
8/8/2019 2. Version Control
51/52
Tips
...XYZ "is not a working copy directory error1."externally" remove XYZ from system
2.svn cleanup (to unlock parent directory)
3.svn revert XYZ (to remove "missing tag")
8/8/2019 2. Version Control
52/52
Thank you for your time