Source Control
Dr. Scott Schaefer
Version Control Systems
• Allow for maintenance and archiving of multiple versions of code / other files• Designed for text files… can be used with other
files, but some functionality won’t work
• Saves multiple copies of the same file
• Tracks changes to each file among multiple users
• Allows multiple users to edit the same file at the same time
Subversion
• Open-source version control system• Builds on CVS• Can handle local or remote repositories• Stores and transfers diffs of files… not
entire files (efficient)
ExampleRepository
User 1
User 2
X Z
Y
ExampleRepository
User 1
User 2
X Z
Y
add Xadd Yadd Z
ExampleRepository
User 1
User 2
X Z
Y
CommitX Z
Y1
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Checkout
X Z
Y
1
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Modify Y
X Z
Y
1
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Commit
X Z
Y
X Z
Y
1
2
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Update
X Z
Y
X Z
Y
1
2
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Modify X
X Z
Y
X Z
Y
Modify X1
2
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Commit
X Z
Y
X Z
Y
X Z
Y
1
2
3
ExampleRepository
User 1
User 2
X Z
Y
X Z
Y
Update
X Z
Y
X Z
Y
X Z
Y
merged text!
1
2
3
Another ExampleRepository
User 1
User 2
X
Y
X Z
Y
X Z
Y
1
Delete Z
Another ExampleRepository
User 1
User 2
X
Y
X Z
Y
X Z
Y
1
Commit
X
Y2
Another ExampleRepository
User 1
User 2
X
Y
X Z
Y
X
Y
1
Update
X
Y2
Conflicts
• Happen when you and someone else edit the same line of code
<<<<<<<<< .mine
Your change
=========
Someone else’s change
>>>>>>>>> .r 23
• Subversion keeps both your original (foo.mine) and the revision (foo.23)
Living with Version Control
• ALWAYS update before you commit changes
• If files change during the update, make sure everything works before you commit
• If you have a conflict, you MUST resolve the conflict before committing
• Update often to avoid conflicts
• Add descriptions to all of your commits
Your Project
• You MUST use version control for all of your projects
• I strongly suggest using Google Code as your SVN server• You can access it from anywhere