Slide 1Slide 2Slide 3Slide 4Slide 5Slide 6Slide 7Slide 8Slide 9Slide 10Slide 11Slide 12Slide 13Slide 14Slide 15Slide 16Slide 17Slide 18Slide 19Slide 20Slide 21Slide 22Slide 23Slide 24Slide 25Slide 26Slide 27Slide 28Slide 29Slide 30Slide 31Slide 32Slide 33Slide 34Slide 35Slide 36Slide 37Slide 38Slide 39Slide 40Slide 41Slide 42Slide 43Slide 44Slide 45Slide 46Slide 47Slide 48Slide 49Slide 5015-410, F’04- 1 -PRCSSep. 24, 2004Dave EckhardtDave EckhardtBruce MaggsBruce MaggsZach Anderson (S '03)Zach Anderson (S '03)L11_PRCS15-410“...Goals: Time Travel, Parallel Universes...”15-410, F’04- 1 -OutlineMotivationMotivationRepository vs. Working DirectoryRepository vs. Working DirectoryConflicts and MergingConflicts and MergingBranchingBranchingPRCS – Project Revision Control SystemPRCS – Project Revision Control System15-410, F’04- 1 -GoalsWorking together should be easyWorking together should be easyTime travelTime travel–Useful for challenging patents–Very useful for reverting from a sleepless hack sessionParallel universesParallel universes–Experimental universes–Product-support universes15-410, F’04- 1 -Goal: Shared WorkspaceReduce development latency via parallelismReduce development latency via parallelism–[But: Brooks, Mythical Man-Month]AliceCharlieBobDevonawesome.c15-410, F’04- 1 -Goal: Time TravelRetrieving old versions should be easy.Retrieving old versions should be easy.Once Upon A Time…Alice: What happened to the code? It doesn’t work.Charlie: Oh, I made some changes. My code is 1337!Alice: Rawr! I want the code from last Tuesday!15-410, F’04- 1 -Goal: Parallel UniversesSafe process for implementing new features.Safe process for implementing new features.–Develop bell in one universe–Develop whistle in another–Don't inflict B's core dumps on W–Eventually produce bell-and-whistle release15-410, F’04- 1 -How?Keep a global repository for the project.Keep a global repository for the project.15-410, F’04- 1 -The RepositoryVersionVersion–Contents of some files at a particular point in time–aka “Snapshot”ProjectProject–A “sequence” of versions●(not really)RepositoryRepository–Directory where projects are stored15-410, F’04- 1 -The RepositoryStored in group-accessible locationStored in group-accessible location–Old way: file system–Modern way: “repository server”Versions Versions in repositoryin repository visible group-wide visible group-wide–Whoever has read access–“Commit access” often separate15-410, F’04- 1 -How?Keep a global repository for the project.Keep a global repository for the project.Each user keeps a working directory.Each user keeps a working directory.15-410, F’04- 1 -The Working DirectoryMany names (“sandbox”)Many names (“sandbox”)Where revisions happenWhere revisions happenTypically belongs to Typically belongs to oneone user userVersions are Versions are checked outchecked out to here to hereNew versions are New versions are checked inchecked in from here from here15-410, F’04- 1 -How?Keep a global repository for the project.Keep a global repository for the project.Each user keeps a working directory.Each user keeps a working directory.Concepts of Concepts of checking outchecking out, and , and checking inchecking in15-410, F’04- 1 -Checking Out. Checking In.Checking out Checking out –A version is copied from the repository●Typically “Check out the latest”●Or: “Revision 3.1.4”, “Yesterday noon”WorkWork–Edit, add, remove, rename filesChecking in Checking in –Working directory repository atomically–Result: new version15-410, F’04- 1 -Checking Out. Checking In.Repository Working Directory v0.1v0.1 copyv0.1check out15-410, F’04- 1 -Checking Out. Checking In.Repository Working Directory v0.1v0.1++v0.1 copymutatev0.115-410, F’04- 1 -Checking Out. Checking In.Repository Working Directory v0.1 v0.2v0.1++v0.2v0.1check in15-410, F’04- 1 -How?Keep a global repository for the project.Keep a global repository for the project.Each user keeps a working directory.Each user keeps a working directory.Concepts of Concepts of checking outchecking out, and , and checking inchecking inMechanisms for Mechanisms for mergingmerging15-410, F’04- 1 -Conflicts and MergingTwo people check out.Two people check out.–Both modify foo.cEach wants to check in a new version.Each wants to check in a new version.–Whose is the correct new version?15-410, F’04- 1 -Conflicts and MergingConflictConflict–Independent changes which “overlap”–Textual overlap detected by revision control–Semantic conflict cannot beMerge displays conflicting updates per fileMerge displays conflicting updates per filePick which code goes into the new versionPick which code goes into the new version–A, B, NOTAPicture now, example laterPicture now, example later15-410, F’04- 1 -Alice Begins WorkRepositoryAlice Bobv0.2v0.2copyv0.2fix b#115-410, F’04- 1 -Bob Arrives, Checks OutRepositoryAlice Bobv0.2v0.2copyv0.2copyv0.2fix b#115-410, F’04- 1 -Alice Commits, Bob Has CoffeeRepositoryAlice Bobv0.2v0.3v0.2copyv0.2copyv0.2fix b#115-410, F’04- 1 -Bob Fixes Something TooRepositoryAlice Bobv0.2v0.3v0.2fix b#7v0.2copyv0.2copyv0.2fix b#115-410, F’04- 1 -Wrong Outcome #1RepositoryAlice Bobv0.2v0.3v0.2fix b#7v0.2copyv0.2copyv0.2fix b#1v0.315-410, F’04- 1 -Wrong Outcome #2RepositoryAlice Bobv0.2v0.3v0.4v0.2fix b#7v0.2copyv0.2copyv0.2fix b#115-410, F’04- 1 -Merge, Bob, Merge!RepositoryAlice Bobv0.2v0.3v0.2fix b#7v0.2copyv0.2copyv0.2fix b#1fix b#1fix b#715-410, F’04- 1 -Committing Real ProgressRepositoryAlice Bobv0.2v0.3v0.4v0.2fix b#7v0.2copyv0.2copyv0.2fix b#1fix b#1fix b#715-410, F’04- 1 -How?Keep a global repository for the project.Keep a global repository for the project.Each user keeps a working directory.Each user keeps a working directory.Concepts of Concepts of checking outchecking out, and , and checking inchecking inMechanisms for Mechanisms for mergingmergingMechanisms for Mechanisms for branchingbranching15-410, F’04- 1 -BranchingA branch is a A branch is a sequence of versionssequence of versions–(not really...)Changes on one branch don't affect othersChanges on one branch don't affect othersProject may contain many branchesProject may contain many branchesWhy branch?Why branch?–Implement a new “major” feature–Begin an independent sequence of development15-410, F’04- 1 -Branching v0.3 v1.1branch v0.37 v1.42 v1.43mergeThe actual branching and
View Full Document