Adapted from Prof. Necula CS 169, Berkeley1 Version Control V22.0474-001 Software Engineering Lecture 12, Spring 2008 Clark Barrett, New York University.

Slides:



Advertisements
Similar presentations
1. What is Subversion? Why do we need CM? Basic concepts Repositories Options Setup Clients Options Setup Operation Troubleshooting Slide 2.
Advertisements

Version Control System (Sub)Version Control (SVN).
1 Using Subversion: Nirav Dave Computer Science & Artificial Intelligence Lab Massachusetts Institute of Technology.
Version Control System Sui Huang, McMaster University Version Control SystemSui Huang, McMaster University Version Control System -- base on Subversion.
Source Control in MATLAB A tool for tracking changes in software development projects. Stuart Nelis & Rachel Sheldon.
CSE 331 SOFTWARE DESIGN & IMPLEMENTATION VERSION CONTROL UW Autumn 2011.
David Notkin Autumn 2009 CSE303 Lecture 22 Subversion is an open source version control system. Social Implications Friday version control system.
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.
Source Code Revision Control with Subversion Christophe Dupré May 13, 2005 Update KEJ May 10, 2006 Scientific Computation Research Center Rensselaer Polytechnic.
Version Control Systems Phil Pratt-Szeliga Fall 2010.
CVS II: Parallelizing Software Development Author: Brian Berliner John Tully.
CS 501 : An Introduction to SCM & GForge An Introduction to SCM & GForge Lin Guo
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.
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.
Prof. Aiken CS 169 Lecture 71 Version Control CS169 Lecture 7.
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.
1 Topics for this Lecture Software maintenance in general Source control systems (intro to svn)
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
Introduction to Version Control
1 Lecture 19 Configuration Management Software Engineering.
Git – versioning and managing your software L. Grewe.
CVS 簡介 數位芝麻網路公司蔡志展 2001/8/18 大綱 • CVS 簡介 • CVS 安裝 • CVS 設定 (Linux/Windows) • CVS 指令簡介 • CVS 多人環境的應用.
Object-Oriented Software Engineering Using UNIX groups and Subversion Estimated Time: minutes “Unix is user-friendly. It's just very selective about.
Object-Oriented Software Engineering Using UNIX groups and CVS Estimated Time: minutes.
…using Git/Tortoise Git
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.
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
1 Brief Introduction to Revision Control Ric Holt.
11 Version Control Systems Mauro Jaskelioff (originally by Gail Hopkins)
CVS – concurrent versions system AROC Guatemala July 19-23, 2010 Guatemala City, Guatemala.
CS425 / CSE424 / ECE428 — Distributed Systems — Fall 2011 Some material derived from slides by Prashant Shenoy (Umass) & courses.washington.edu/css434/students/Coda.ppt.
1 CSE306 Operating Systems Projects CVS/SSH tutorial.
CVS: Concurrent Version System Lecturer: Prof. Andrzej (AJ) Bieszczad Phone: “UNIX for Programmers and Users” Third.
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 System
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
Recitation 2: Abhijit Warkhedi2/25/20161 Today’s Agenda u CVS u GDB.
1 CSE 303 Lecture 19 Version control and Subversion ( svn ) slides created by Marty Stepp
TEAM FOUNDATION VERSION CONTROL AN OVERVIEW AND WALKTHROUGH By: Michael Mallar.
(1) Introduction to Subversion (SVN) and Google Project Hosting Philip Johnson Collaborative Software Development Laboratory Information and Computer Sciences.
Source Control Repositories for Enabling Team Working Doncho Minkov Telerik Corporation
NALINI S. NAUTIYAL SYSTEM SOFTWARE DIVISION Subversion.
DIGITAL REPOSITORIES CGDD Job Description… Senior Tools Programmer – pulled August 4 th, 2011 from Gamasutra.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
CompSci 230 Software Construction
CVS – concurrent versions system
CVS – concurrent versions system
LECTURE 2: Software Configuration Management
Concurrent Version Control
LECTURE 3: Software Configuration Management
slides borrowed and adapted from Alex Mariakis and CSE 390a
CVS Concurrent Versioning System
Git CS Fall 2018.
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
Presentation transcript:

Adapted from Prof. Necula CS 169, Berkeley1 Version Control V Software Engineering Lecture 12, Spring 2008 Clark Barrett, New York University

Adapted from Prof. Necula CS 169, Berkeley 2 Configuration Management Configuration Management refers to a set of procedures for managing an evolving software system. It typically includes the following: –Version control –Support for automated system building –Support for automated system testing/bug-tracking –Support for multiple platforms –Release management In this lecture, we focus on version control. We will come back to the others later.

Adapted from Prof. Necula CS 169, Berkeley 3 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

Adapted from Prof. Necula CS 169, Berkeley 4 Version Control Version control tracks multiple versions In particular, allows –old versions to be recovered –multiple versions to exist simultaneously Why use version control?

Adapted from Prof. Necula CS 169, Berkeley 5 Why Use Version Control? To allow more than one developer to work on the code Can easily recreate old versions Change log Comparison with old versions very useful for debugging May need multiple versions of the same project

Adapted from Prof. Necula CS 169, Berkeley 6 Scenario I: Bug Fix Time 1.0 First public release of the hot new product

Adapted from Prof. Necula CS 169, Berkeley 7 Scenario I: Bug Fix 1.0 Time Internal development continues, progressing to version

Adapted from Prof. Necula CS 169, Berkeley 8 Scenario I: Bug Fix 1.0 Time 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

Adapted from Prof. Necula CS 169, Berkeley 9 Scenario I: Bug Fix 1.0 Time Note that there are now two lines of development beginning at 1.0. This is branching bugfix

Adapted from Prof. Necula CS 169, Berkeley 10 Scenario I: Bug Fix 1.0 Time The bug fix should also be applied to the main code line so that the next product release has the fix bugfix 1.4

Adapted from Prof. Necula CS 169, Berkeley 11 Scenario I: Bug Fix 1.0 Time Note that two separate lines of development come back together in 1.4. This is merging or updating bugfix 1.4

Adapted from Prof. Necula CS 169, Berkeley 12 Scenario II: Normal Development 1.5 Time You are in the middle of a project with three developers named a, b, and c.

Adapted from Prof. Necula CS 169, Berkeley 13 Scenario II: Normal Development 1.5 Time 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

Adapted from Prof. Necula CS 169, Berkeley 14 Scenario II: Normal Development 1.5 Time 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

Adapted from Prof. Necula CS 169, Berkeley 15 Scenario II: Normal Development 1.5 Time 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.

Adapted from Prof. Necula CS 169, Berkeley 16 Scenario II: Normal Development 1.5 Time 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.

Adapted from Prof. Necula CS 169, Berkeley 17 Scenario III: Debugging 1.5 Time 1.6 You develop a software system through several revisions. 1.7

Adapted from Prof. Necula CS 169, Berkeley 18 Scenario III: Debugging 1.5 Time 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

Adapted from Prof. Necula CS 169, Berkeley 19 Scenario IV: Libraries Time You are building software on top of a third-party library, for which you have source. Library A

Adapted from Prof. Necula CS 169, Berkeley 20 Scenario IV: Libraries Time Library A You begin implementation of your software, including modifications to the library. 0.7

Adapted from Prof. Necula CS 169, Berkeley 21 Scenario IV: Libraries Time 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.

Adapted from Prof. Necula CS 169, Berkeley 22 Scenario IV: Libraries Time 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

Adapted from Prof. Necula CS 169, Berkeley 23 CVS CVS stands for “Concurrent Versions System” It is a commonly-used open-source program for version control. I recommend you use CVS for your project. More information available at

Adapted from Prof. Necula CS 169, Berkeley 24 Concepts Repository Projects Working Copy Revisions Merging Conflicts Branches

Adapted from Prof. Necula CS 169, Berkeley 25 Repository In order to use CVS, you must have a repository, a location which CVS can use to store information about multiple versions Typically, one repository may hold many different projects

Adapted from Prof. Necula CS 169, Berkeley 26 Creating a Repository Using CVS To create a repository, you must specify an absolute pathname Create a repository using the following CVS command: cvs –d init For example, the following command creates a repository in the current directory: >cvs –d $PWD/repository init

Adapted from Prof. Necula CS 169, Berkeley 27 Sharing a Repository If you want others in your group to be able to access your repository, your home directory must be group writable: >chmod g+w ~/. Also, the repository must belong to the group and be writable: >chgrp –R repository >chmod g+rwx repository

Adapted from Prof. Necula CS 169, Berkeley 28 Projects A project is a set of files in version control 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

Adapted from Prof. Necula CS 169, Berkeley 29 Creating a Project in CVS Suppose you want to use CVS to track changes to a set of files in directory >cd >cvs –d import –m “Imported sources” start To create an empty project, just import from an empty directory: >mkdir myproj >cd myproj >cvs –d import –m “Imported sources” myproj myproj start

Adapted from Prof. Necula CS 169, Berkeley 30 Creating a Project in CVS If you get an error about being unable to create a temporary file, set the shell environment variable TMPDIR as follows: >export TMPDIR=/tmp OR, if you are running csh or tcsh: >setenv TMPDIR /tmp

Adapted from Prof. Necula CS 169, Berkeley 31 Creating a Working Copy Once a project has been imported into the CVS repository, anyone can create a working copy: >newgrp >cvs –d co >cd >ls The working copy contains a directory CVS which stores information about the project and the repository.

Adapted from Prof. Necula CS 169, Berkeley 32 Adding a file To add a file to the project, first create it, then use the cvs add and cvs commit commands Example >emacs main.cpp > >cvs add main.cpp >cvs commit –m “initial revision” main.cpp

Adapted from Prof. Necula CS 169, Berkeley 33 Adding a directory Adding a directory is almost the same as adding a file: Example >mkdir newModule >cvs add newModule >cvs commit –m “initial revision” newModule Note that you may need to fix the permissions in the repository after adding a directory: >cd >chgrp –R. >chmod g+rwx *

Adapted from Prof. Necula CS 169, Berkeley 34 Working with Multiple Copies CVS allows multiple users to edit files at the same time. The process works like this: First, update your working copy: >cvs update –d Next, make changes to your working copy Finally, commit your changes: >cvs commit –m “My changes"

Adapted from Prof. Necula CS 169, Berkeley 35 Revisions Consider –Check out a project –Edit some files –Check the files back in This creates a new version of each file –Usually increment minor version number –E.g., 1.5 -> 1.6

Adapted from Prof. Necula CS 169, Berkeley 36 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 In practice, not significant

Adapted from Prof. Necula CS 169, Berkeley 37 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

Adapted from Prof. Necula CS 169, Berkeley 38 Merging Start with a file, say main.cpp, revision 1.1 Alice makes changes A to 1.1 Bob makes changes B to 1.1 Assume Bob checks in first –Current revision is 1.2 = apply(B,1.1)

Adapted from Prof. Necula CS 169, Berkeley 39 Merging (Cont.) Now Alice checks in –System notices that Alice had checked out 1.1 –But current version is 1.2 –Alice has not made her changes in the current version! The system complains –Alice is told to update her local copy of the code

Adapted from Prof. Necula CS 169, Berkeley 40 Merging (Cont.) Alice does an update –This applies Bob’s changes B to Alice’s code Remember Alice’s code is apply(A,1.1) Current version is 1.2 = apply(B, 1.1) Two possible outcomes of an update –Success –Conflicts

Adapted from Prof. Necula CS 169, Berkeley 41 Success Assume that apply(A,apply(B,1.1)) = apply(B,apply(A,1.1)) Then order of changes didn’t matter –Same result whether Bob or Alice checks in first –The version control system is happy with this Alice can now check in her changes –Obtaining 1.3 = apply(A, 1.2) = apply(A, apply(B,1.1))

Adapted from Prof. Necula CS 169, Berkeley 42 Failure Now, assume Alice and Bob make new changes to version 1.3 and apply(A’,apply(B’,1.3))  apply(B’,apply(A’,1.3)) There is a conflict –The order of the changes matters –Version control will complain

Adapted from Prof. Necula CS 169, Berkeley 43 Conflicts Arise when two programmers edit the same piece of code –One change overwrites another 1.3:“Hello world” Alice:“Hello world, my name is Alice” Bob: “Hello world, my name is Bob” The system doesn’t know what should be done, and so complains of a conflict.

Adapted from Prof. Necula CS 169, Berkeley 44 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 Conflicts must be resolved by hand –Symptom of bad communication

Adapted from Prof. Necula CS 169, Berkeley 45 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

Adapted from Prof. Necula CS 169, Berkeley 46 Example With No Conflict Revision 1.6: 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

Adapted from Prof. Necula CS 169, Berkeley 47 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... –Rare in practice, if you maintain good team communication

Adapted from Prof. Necula CS 169, Berkeley 48 Branches A branch is just two separate revisions of a file that do not get merged –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 –Must explicitly merge branches

Adapted from Prof. Necula CS 169, Berkeley 49 CVS Tags Some operations require a snapshot of the global project state –Branching –Major releases CVS can tag a project with a name

Adapted from Prof. Necula CS 169, Berkeley 50 CVS Remote Repository Normally, repository is on the local file system –Hard to collaborate between distributed teams CVS can run in client-server mode –Server machine runs ssh server and keeps the repository –Client machine queries the server –Only diffs are being sent => fast even on slow net –Converts automatically MSDOS/Unix files –Use it to keep source files synchronized