Version Control Kenneth M Anderson University of Colorado Boulder CSCI 5828 Lecture 13 02 24 2009 University of Colorado 2009 1 Goals Review material from Chapter 6 of Pilone Miles Version Control Configuration Management Working Without a Net Repository Management Init Add Branch Merge 2 Without a Net I 3 Doing software development without configuration management is working without a net Configuration management refers to both a process and a technology The process encourages developers to work in such a way that changes to code are tracked changes become first class objects that can be named tracked discussed and manipulated The technology is any system that provides features to enable this process Without a Net II 4 If you don t use configuration management then you are not keeping track of changes you won t know when features were added you won t know when bugs were introduced or fixed you won t be able to go back to old versions of your software You would be living in the now with the code There is only one version of the system this one You would have no safety net Without a Net III Developer 1 5 Two developers need to modify the same file for the task they are working on Demo Machine Developer 2 A Without a Net IV Developer 1 A 6 They both download the file from the demo machine creating two working copies Demo Machine working copy Developer 2 A A Without a Net V Developer 1 7 They both edit their copies and test the new functionality A1 Demo Machine Developer 2 A2 A Without a Net VI Developer 1 A1 8 Developer 1 finishes first and uploads his copy to the demo machine Demo Machine Developer 2 A2 A1 A Without a Net VII Developer 1 A1 9 Developer 2 finishes second and uploads his copy to the demo machine Demo Machine Developer 2 A2 A2 A1 A Without a Net VIII 10 This is known as last check in wins Demo Machine A2 A1 A At best developer 1 s work is simply gone when the demo is run At worst developer 1 checked in other changes that cause developer 2 s work to crash when the demo is run Not Acceptable 11 This type of uncertainty and instability is simply not acceptable in production software environments That s where configuration management comes in The book uses the term version control But in the literature version control is versioning applied to a single file while configuration management is versioning applied to collections of files Versioning 2 1 Another bug fix release v 1 1 1 First draft of code buggy 2 Fix some bugs release v 1 0 3 Begin adding spellcheck feature 4 spellcheck feature complete may have bugs 5 changes merged more bugs fixed release v 2 0 12 Configuration Management Particular versions of files are included in File A File B 1 1 2 2 3 4 5 3 4 5 different versions of a configuration Configuration Z 1 1 v 0 1 3 2 v 1 0 5 4 v 1 2 13 With a Net I Developer 1 14 Repository A Developer 2 Demo Machine Two developers need to modify the same file for separate tasks With a Net II 15 Developer 1 Repository A A Developer 2 Demo Machine A They check the file out into their own working copies With a Net III 16 Developer 1 Repository A1 A Developer 2 Demo Machine A2 They modify their copies With a Net IV 17 Developer 1 Repository A1 A1 A Developer 2 Demo Machine A2 Developer 1 finishes first With a Net V 18 Developer 1 Repository A1 A1 A2 A Developer 2 Demo Machine A2 Developer 2 finishes and tries to check in but With a Net VI 19 Developer 1 Repository A1 A1 A Developer 2 Demo Machine A2 the change is rejected because it conflicts with A1 With a Net VI Developer 1 A1 Developer 2 This is known as first checkin wins 19 Repository A1 A Demo Machine A2 the change is rejected because it conflicts with A1 With a Net VII 20 Developer 1 Repository A1 A1 A Developer 2 Demo Machine A1 A2 A2 What is sent back is an amalgam of A1 and A2 s changes With a Net VII 20 Developer 1 Repository A1 A1 A Developer 2 The file will not be syntactically correct and will not compile Demo Machine A1 A2 A2 What is sent back is an amalgam of A1 and A2 s changes With a Net VII 21 Developer 1 Repository A1 A1 A Developer 2 Demo Machine A3 It is up to Developer 2 to merge the changes correctly With a Net VII 22 Developer 1 Repository A1 A1 A3 A Developer 2 Demo Machine A3 He tells the repository the conflict has been resolved and checks the file in again With a Net VII 23 Developer 1 Repository A1 A3 A1 A3 A Developer 2 Demo Machine A3 Developer 1 can now update his local copy and check the changes on his machine With a Net VII 24 Developer 1 Repository A1 A3 A1 A3 A Developer 2 Demo Machine A3 A3 When they are both satisfied the system can be deployed to the demo machine and a successful demo occurs Why Multiple Copies Old versioning systems RCS did not allow multiple developers to edit a single file at a same time Only one dev could lock the file at a time 25 When two developers edit the same file at the same time they often make changes to different parts of the file such changes can easily be merged What changed The assumption that conflicts occur a lot data showed they don t happen very often A1 A2 A3 Tags Branches and Trunks Oh My 26 Configuration management systems can handle the basics of checking out the latest version of a system making changes and checking the changes back in These changes are committed to what is typically called the trunk or main line of development git calls it the master branch But configuration management systems can do much more than handle changes to the version of a system that is under active development and that s where tags and branches come in Scenario I 27 In the book a development team has released version 1 0 of a system and has moved on to work on version 2 0 they make quite a bit of progress when their customer reports a significant bug with version 1 0 None of the developers have version 1 0 available on their machines and none of them can remember what version of the repository corresponded to release 1 0 This highlights the need for good commit messages when you are checking in changes be very explicit about what it is you have done you may need that information later Remember this diagram The numbers in boxes are repository versions the text in bold represent tags 2 1 Another bug fix release v 1 1 1 First draft of code buggy 2 Fix some bugs …
View Full Document
Unlocking...