Prof. Aiken CS 169 Lecture 71 Version Control CS169 Lecture 7.

Slides:



Advertisements
Similar presentations
1 IST 410/420 Software Version Control 2 DevelopmentIntegration Test System Test User Acceptance Testing ProductionArchive DEVELOPMENTUSERS - Developers.
Advertisements

Version Control System (Sub)Version Control (SVN).
1 Using Subversion: Nirav Dave Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology.
Source Control in MATLAB A tool for tracking changes in software development projects. Stuart Nelis & Rachel Sheldon.
Concepts of Version Control A Technology-Independent View.
2/6/2008Prof. Hilfinger CS164 Lecture 71 Version Control Lecture 7.
Using subversion COMP 2400 Prof. Chris GauthierDickey.
CVS II: Parallelizing Software Development Author: Brian Berliner John Tully.
CS 501 : An Introduction to SCM & GForge An Introduction to SCM & GForge Lin Guo
Applied Software Project Management Andrew Stellman & Jennifer Greene Applied Software Project Management Applied Software.
Adapted from Prof. Necula CS 169, Berkeley1 Version Control V Software Engineering Lecture 12, Spring 2008 Clark Barrett, New York University.
Low level CASE: Source Code Management. Source Code Management  Also known as Configuration Management  Source Code Managers are tools that: –Archive.
Source Code Management Or Configuration Management: How I learned to Stop Worrying and Hate My Co-workers Less.
1 CMPT 275 Software Engineering Revision Control.
Source Control Repositories for Enabling Team Working Svetlin Nakov Telerik Corporation
G51FSE Version Control Naisan Benatar. Lecture 5 - Version Control 2 On today’s menu... The problems with lots of code and lots of people Version control.
SubVersioN – the new Central Service at DESY by Marian Gawron.
Git for Version Control These slides are heavily based on slides created by Ruth Anderson for CSE 390a. Thanks, Ruth! images taken from
Version Control with Subversion. What is Version Control Good For? Maintaining project/file history - so you don’t have to worry about it Managing collaboration.
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Introduction to Version Control
Version Control with Subversion Quick Reference of Subversion.
1 Debugging and Testing Overview Defensive Programming The goal is to prevent failures Debugging The goal is to find cause of failures and fix it Testing.
University of Maryland Bug Driven Bug Finding Chadd Williams.
1 Lecture 19 Configuration Management Software Engineering.
Git – versioning and managing your software L. Grewe.
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
CVS 簡介 數位芝麻網路公司蔡志展 2001/8/18 大綱 • CVS 簡介 • CVS 安裝 • CVS 設定 (Linux/Windows) • CVS 指令簡介 • CVS 多人環境的應用.
Branching. Version Control - Branching A way to write code without affecting the rest of your team Merge branches to integrate your changes.
Version control Using Git Version control, using Git1.
…using Git/Tortoise Git
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Chris Onions Getting started with CVS in ATLAS 11 Getting started with CVS in ATLAS Chris Onions (Tutorial based on that of Raúl Ramos Pollán CERN / IT.
Version Control.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
An Intro to Concurrent Versions System (CVS) ECE 417/617: Elements of Software Engineering Stan Birchfield Clemson University.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
Progress with migration to SVN Part3: How to work with g4svn and geant4tags tools. Geant4.
Computer Science and Engineering The Ohio State University  Widely used, especially in the opensource community, to track all changes to a project and.
CVS – concurrent versions system Network Management Workshop intERlab at AIT Thailand March 11-15, 2008.
CSE 219 Computer Science III CVS
11 Version Control Systems Mauro Jaskelioff (originally by Gail Hopkins)
CVS – concurrent versions system AROC Guatemala July 19-23, 2010 Guatemala City, Guatemala.
Version Control Systems. Version Control Manage changes to software code – Preserve history – Facilitate multiple users / versions.
Design - programming Cmpe 450 Fall Dynamic Analysis Software quality Design carefully from the start Simple and clean Fewer errors Finding errors.
1 MSTE Visual SourceSafe For more information, see:
P51UST: Unix and SoftwareTools Unix and Software Tools (P51UST) Version Control Systems Ruibin Bai (Room AB326) Division of Computer Science The University.
Version Control *Slides are modified from Prof. Necula from CS169.
12 CVS Mauro Jaskelioff (originally by Gail Hopkins)
Version Control and SVN ECE 297. Why Do We Need Version Control?
Recitation 2: Abhijit Warkhedi2/25/20161 Today’s Agenda u CVS u GDB.
TEAM FOUNDATION VERSION CONTROL AN OVERVIEW AND WALKTHROUGH By: Michael Mallar.
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
Source Control Repositories for Enabling Team Working Doncho Minkov Telerik Corporation
NALINI S. NAUTIYAL SYSTEM SOFTWARE DIVISION Subversion.
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
DIGITAL REPOSITORIES CGDD Job Description… Senior Tools Programmer – pulled August 4 th, 2011 from Gamasutra.
CompSci 230 Software Construction
LECTURE 2: Software Configuration Management
CVS revisions UML diagram
Akshay Narayan git up to speed with RCS Akshay Narayan
Hao Zhong Shanghai Jiao Tong University
LECTURE 3: Software Configuration Management
Design and Programming
Computer Science Testing.
Version Control CS169 Lecture 7 Prof. Aiken CS 169 Lecture 7 1.
Version Control CS169 Lecture 7 Prof. Aiken CS 169 Lecture 7.
Prof. Hilfinger CS164 Lecture 4
Review of Previous Lesson
Overview Activities from additional UP disciplines are needed to bring a system into being Implementation Testing Deployment Configuration and change management.
Presentation transcript:

Prof. Aiken CS 169 Lecture 71 Version Control CS169 Lecture 7

Prof. Aiken CS 169 Lecture 72 Outline What is version control? –And why use it? –Scenarios Basic concepts –Projects –Branches –Merging conflicts Two systems –PRCS –CVS

Prof. Aiken CS 169 Lecture 73 All Software Has Multiple Versions Different releases of a product Variations for different platforms Hardware and software Versions within a development cycle Test release with debugging code Alpha, beta of final release Each time you edit a program

Prof. Aiken CS 169 Lecture 74 Version Control Version control tracks multiple versions In particular, allows –old versions to be recovered –multiple versions to exist simultaneously

Prof. Aiken CS 169 Lecture 75 Why Use Version Control? Because everyone does –A basic software development tool Because it is useful –You will want old/multiple versions –Without version control, can’t recreate project history Because we require it –For your own good –The only such requirement in the course...

Prof. Aiken CS 169 Lecture 76 Scenario I: Bug Fix Time Releases 1.0 First public release of the hot new product

Prof. Aiken CS 169 Lecture 77 Scenario I: Bug Fix 1.0 Time Releases Internal development continues, progressing to version

Prof. Aiken CS 169 Lecture 78 Scenario I: Bug Fix 1.0 Time Releases A fatal bug is discovered in the product (1.0), but 1.3 is not stable enough to release. Solution: Create a version based on 1.0 with the bug fix bugfix

Prof. Aiken CS 169 Lecture 79 Scenario I: Bug Fix 1.0 Time Releases Note that there are now two lines of development beginning at 1.0. This is branching bugfix

Prof. Aiken CS 169 Lecture 710 Scenario I: Bug Fix 1.0 Time Releases The bug fix should also be applied to the main code line so that the next product release has the fix bugfix 1.4

Prof. Aiken CS 169 Lecture 711 Scenario I: Bug Fix 1.0 Time Releases Note that two separate lines of development come back together in 1.4. This is merging or updating bugfix 1.4

Prof. Aiken CS 169 Lecture 712 Scenario II: Normal Development 1.5 Time Releases You are in the middle of a project with three developers named a, b, and c.

Prof. Aiken CS 169 Lecture 713 Scenario II: Normal Development 1.5 Time Releases At the beginning of the day everyone checks out a copy of the code. A check out is a local working copy of a project, outside of the version control system. Logically it is a (special kind of) branch. 1.5a 1.5b 1.5c

Prof. Aiken CS 169 Lecture 714 Scenario II: Normal Development 1.5 Time Releases The local versions isolate the developers from each other’s possibly unstable changes. Each builds on 1.5, the most recent stable version. 1.5a 1.5b 1.5c

Prof. Aiken CS 169 Lecture 715 Scenario II: Normal Development 1.5 Time Releases 1.5a 1.5b 1.5c 1.6 At 4:00 pm everyone checks in their tested modifications. A check in is a kind of merge where local versions are copied back into the version control system.

Prof. Aiken CS 169 Lecture 716 Scenario II: Normal Development 1.5 Time Releases 1.5a 1.5b 1.5c 1.6 In many organizations check in automatically runs a test suite against the result of the check in. If the tests fail the changes are not accepted. This prevents a sloppy developer from causing all work to stop by, e.g., creating a version of the system that does not compile.

Prof. Aiken CS 169 Lecture 717 Scenario III: Debugging 1.5 Time Releases 1.6 You develop a software system through several revisions. 1.7

Prof. Aiken CS 169 Lecture 718 Scenario III: Debugging 1.5 Time Releases 1.6 In 1.7 you suddenly discover a bug has crept into the system. When was it introduced? With version control you can check out old versions of the system and see which revision introduced the bug. 1.7

Prof. Aiken CS 169 Lecture 719 Scenario IV: Libraries Time Releases You are building software on top of a third-party library, for which you have source. Library A

Prof. Aiken CS 169 Lecture 720 Scenario IV: Libraries Time Releases Library A You begin implementation of your software, including modifications to the library. 0.7

Prof. Aiken CS 169 Lecture 721 Scenario IV: Libraries Time Releases Library A0.7 Library B A new version of the library is released. Logically this is a branch: library development has proceeded independently of your own development.

Prof. Aiken CS 169 Lecture 722 Scenario IV: Libraries Time Releases Library A You merge the new library into the main code line, thereby applying your modifications to the new library version. 0.7 Library B 0.8

Prof. Aiken CS 169 Lecture 723 Concepts Projects Revisions Branches Merging Conflicts

Prof. Aiken CS 169 Lecture 724 Projects A project is a set of files in version control –Called a module in CVS Version control doesn’t care what files –Not a build system –Or a test system Though there are often hooks to these other systems –Just manages versions of a collection of files

Prof. Aiken CS 169 Lecture 725 Assumption Consider a project with 1 file We will return to the multiple file case later

Prof. Aiken CS 169 Lecture 726 Revisions Consider –Check out a file –Edit it –Check the file back in This creates a new version of the file –Usually increment minor version number –E.g., 1.5 -> 1.6

Prof. Aiken CS 169 Lecture 727 Revisions (Cont.) Observation: Most edits are small For efficiency, don’t store entire new file –Store diff with previous version –Minimizes space –Makes check-in, check-out potentially slower Must apply diffs from all previous versions to compute current file

Prof. Aiken CS 169 Lecture 728 Revisions (Cont.) With each revision, system stores –The diffs for that version –The new minor version number –Other metadata Author Time of check in Log file message Results of “smoke test”

Prof. Aiken CS 169 Lecture 729 Branches A branch is just two revisions of a file –Two people check out 1.5 –Check in –Check in Notes –Normally checking in does not create a branch Changes merged into main code line –Must explicitly ask to create a branch

Prof. Aiken CS 169 Lecture 730 Merging Start with a file, say 1.5 Bob makes changes A to 1.5 Alice makes changes B to 1.5 Assume Alice checks in first –Current revision is 1.6 = apply(B,1.5)

Prof. Aiken CS 169 Lecture 731 Merging (Cont.) Now Bob checks in –System notices that Bob checked out 1.5 –But current version is 1.6 –Bob has not made his changes in the current version! The system complains –Bob is told to update his local copy of the code

Prof. Aiken CS 169 Lecture 732 Merging (Cont.) Bob does an update –This applies Alice’s changes B to Bob’s code Remember Bob’s code is apply(A,1.5) Two possible outcomes of an update –Success –Conflicts

Prof. Aiken CS 169 Lecture 733 Success Assume that apply(A,apply(B,1.5) = apply(B,apply(A,1.5)) Then then order of changes didn’t matter –Same result whether Bob or Alice checks in first –The version control system is happy with this Bob can now check in his changes –Because apply(B,apply(A,1.6)) = apply(B,1.6)

Prof. Aiken CS 169 Lecture 734 Failure Assume apply(A,apply(B,1.5)  apply(B,apply(A,1.6)) There is a conflict –The order of the changes matters –Version control will complain

Prof. Aiken CS 169 Lecture 735 Conflicts Arise when two programmers edit the same piece of code –One change overwrites another 1.5:a = b; Alice:a = b++; Bob: a = ++b; The system doesn’t know what should be done, and so complains of a conflict.

Prof. Aiken CS 169 Lecture 736 Conflicts (Cont.) System cannot apply changes when there are conflicts –Final result is not unique –Depends on order in which changes are applied Version control shows conflicts on update –Generally based on diff3 Conflicts must be resolved by hand

Prof. Aiken CS 169 Lecture 737 Conflicts are Syntactic Conflict detection is based on “nearness” of changes –Changes to the same line will conflict –Changes to different lines will likely not conflict Note: Lack of conflicts does not mean Alice’s and Bob’s changes work together

Prof. Aiken CS 169 Lecture 738 Example With No Conflict Revision 1.5: int f(int a, int b) { … } Alice:int f(int a, int b, int c) { … } add argument to all calls to f Bob:add call f(x,y) Merged program –Has no conflicts –But will not even compile

Prof. Aiken CS 169 Lecture 739 Don’t Forget Merging is syntactic Semantic errors may not create conflicts –But the code is still wrong –You are lucky if the code doesn’t compile Worse if it does...

Prof. Aiken CS 169 Lecture 740 Two Systems We discuss –CVS De facto free software standard for version control –PRCS Hilfinger, et al. For single file projects, these are the same –Except for administration

Prof. Aiken CS 169 Lecture 741 PRCS Model Operations are on the project –Not on individual files Example –Project version 1.5 –Check out –Update file foo.bar –Check in –Project version is now 1.6

Prof. Aiken CS 169 Lecture 742 PRCS Model (Cont.) Changes to individual files treated as changes to the project Every state of the project has a name –E.g., 1.6 Makes it possible to recover any point in the project history

Prof. Aiken CS 169 Lecture 743 CVS Model Operations are on files Example –Check out –Modify foo.bar revision 2.7 –Check in –foo.bar now revision 2.8

Prof. Aiken CS 169 Lecture 744 CVS Model (Cont.) CVS knows foo.bar changed –Version 2.7 modified to 2.8 But CVS does not know the state of the rest of the project when foo.bar changed –No correlation kept with other files –Hard to reconstruct every state of the project And in some cases, impossible

Prof. Aiken CS 169 Lecture 745 CVS Tags Some operations require a snapshot of the global project state –Branching –Major releases CVS can tag a project with a name –A separate operation to do what PRCS does for every change

Prof. Aiken CS 169 Lecture 746 Administration PRCS has a simple administrative model –One file with all metadata in a standard format Really, a small project programming language –Administration done by text editing –The administrative file is under version control, too Get old project versions by checking out old admin files CVS administration is much more complex –Numerous files, information scattered throughout One admin file per file under CVS Makes renaming, moving files awkward

Prof. Aiken CS 169 Lecture 747 Design Version control of projects is about snapshots of sets of files –PRCS represents this directly –CVS is oriented toward individual files And it shows in complexity A lesson here for those interested in software design...

Prof. Aiken CS 169 Lecture 748 Trade-offs CVS has many more features than PRCS –In particular, remote repositories –Allows distributed work over ssh If you don’t need remote check in/check out, PRCS may be a better choice