220 likes | 346 Views
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
E N D
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)
Example Repository User 1 X Z Y User 2
Example Repository User 1 add X add Y X Z add Z Y User 2
Example Repository User 1 Commit X Z 1 X Z Y Y User 2
Example Repository User 1 X Z 1 X Z Y Y User 2 Checkout X Z Y
Example Repository User 1 Modify Y X Z 1 X Z Y Y User 2 X Z Y
Example Repository User 1 Commit X Z 1 X Z Y Y X Z 2 User 2 Y X Z Y
Example Repository User 1 X Z 1 X Z Y Y X Z 2 User 2 Update Y X Z Y
Example Repository User 1 Modify X X Z 1 X Z Y Y X Z 2 User 2 Modify X Y X Z Y
Example Repository User 1 X Z 1 X Z Y Y X Z 2 User 2 Commit Y X Z X Z Y 3 Y
Example merged text! Repository User 1 Update X Z 1 X Z Y Y X Z 2 User 2 Y X Z X Z Y 3 Y
Another Example Repository User 1 Delete Z X Z 1 X Y Y User 2 X Z Y
Another Example Repository User 1 Commit X Z 1 X Y Y X 2 User 2 Y X Z Y
Another Example Repository User 1 X Z 1 X Y Y X 2 User 2 Update Y X Y
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