Version Control and SVN ECE 297. Why Do We Need Version Control?

Slides:



Advertisements
Similar presentations
Week 2 DUE This Week: Safety Form and Model Release DUE Next Week: Project Timelines and Website Notebooks Lab Access SharePoint Usage Subversion Software.
Advertisements

Intro to Version Control Have you ever …? Had an application crash and lose ALL of your work Made changes to a file for the worse and wished you could.
Version Control System (Sub)Version Control (SVN).
Simple Git Steve Pieper. Topics Git considerations and Slicer Git as if it were svn Git the way it is meant to be.
Version Control System Sui Huang, McMaster University Version Control SystemSui Huang, McMaster University Version Control System -- base on Subversion.
SOFTWARE REVISION CONTROL WITH SUBVERSION Evan Dickinson & Andy Huang – 9 March 2011.
David Notkin Autumn 2009 CSE303 Lecture 22 Subversion is an open source version control system. Social Implications Friday version control system.
Using subversion COMP 2400 Prof. Chris GauthierDickey.
Version Control Systems Phil Pratt-Szeliga Fall 2010.
Low level CASE: Source Code Management. Source Code Management  Also known as Configuration Management  Source Code Managers are tools that: –Archive.
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.
Version Control with git. Version Control Version control is a system that records changes to a file or set of files over time so that you can recall.
CONTINUOUS INTEGRATION, DELIVERY & DEPLOYMENT ONE CLICK DELIVERY.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Distributed Version Control. Image stolen from which is really good, go read it.  Old-school version control.
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.
Subversion. What is Subversion? A Version Control System A successor to CVS and SourceSafe Essentially gives you a tracked, shared file system.
علیرضا فراهانی استاد درس: جعفری نژاد مهر Version Control ▪Version control is a system that records changes to a file or set of files over time so.
Why you should be using Version Control. Matt Krass Electrical/Software Engineer November 22, 2014.
The Design Workshop Introduction to Version Control 1.
Version Control with Subversion Quick Reference of Subversion.
With Mercurial and Progress.   Introduction  What is version control ?  Why use version control ?  Centralised vs. Distributed  Why Mercurial ?
Git – versioning and managing your software L. Grewe.
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
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.
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.
ITEC 370 Lecture 16 Implementation. Review Questions? Design document on F, feedback tomorrow Midterm on F Implementation –Management (MMM) –Team roles.
…using Git/Tortoise Git
SWEN 302: AGILE METHODS Roma Klapaukh & Alex Potanin.
Information Systems and Network Engineering Laboratory II DR. KEN COSH WEEK 1.
Object-Oriented Analysis & Design Subversion. Contents  Configuration management  The repository  Versioning  Tags  Branches  Subversion 2.
Version Control.
An Intro to Concurrent Versions System (CVS) ECE 417/617: Elements of Software Engineering Stan Birchfield Clemson University.
(Sub)Version Control. 2 Keep large teams working on the same code Back up your work so you don't lose it all Compare changes to previous versions Revert.
Copyright © 2015 – Curt Hill Version Control Systems Why use? What systems? What functions?
SENG 403 Tutorial 1 1SENG 403 – Winter Agenda Version Control Basics Subversion Basic actions in Subversion Some examples 2SENG 403 – Winter 2012.
Computer Science and Engineering The Ohio State University  Widely used, especially in the opensource community, to track all changes to a project and.
By: Anuj Sharma. Topics covered:  GIT Introduction  GIT Benefits over different tools  GIT workflow  GIT server creation  How to use GIT for first.
Developer Best Practices R.SANTHANA GOPALAN. Developer Best Practices What is Workspace ? The directory where the developer edit the source files, compile,
12 CVS Mauro Jaskelioff (originally by Gail Hopkins)
Introduction to Git Yonglei Tao GVSU. Version Control Systems  Also known as Source Code Management systems  Increase your productivity by allowing.
1 CSE 303 Lecture 19 Version control and Subversion ( svn ) slides created by Marty Stepp
Subversion (SVN) Tutorial for CS421 Dan Fleck Spring 2010.
It’s not just an insult from Harry Potter!. What is Git? Distributed Version Control System (DVCS) – Compared to a Centralized Version Control System.
Information Systems and Network Engineering Laboratory I DR. KEN COSH WEEK 1.
NALINI S. NAUTIYAL SYSTEM SOFTWARE DIVISION Subversion.
1 Ivan Marsic Rutgers University LECTURE 2: Software Configuration Management.
CS520 Web Programming Version Control with Subversion Chengyu Sun California State University, Los Angeles.
DIGITAL REPOSITORIES CGDD Job Description… Senior Tools Programmer – pulled August 4 th, 2011 from Gamasutra.
1 Subversion Kate Hedstrom April Version Control Software System for managing source files –For groups of people working on the same code –When.
BIT 285: ( Web) Application Programming Lecture 07 : Tuesday, January 27, 2015 Git.
Git workflows: using multiple branches for parallel development SE-2800 Dr. Mark L. Hornick 1.
Problem Solving With C++ SVN ( Version Control ) April 2016.
Information Systems and Network Engineering Laboratory II
Version Control with Subversion
Sample Wiki Comments?.
SVN intro (review).
LECTURE 2: Software Configuration Management
CSE 303 Concepts and Tools for Software Development
Software Engineering for Data Scientists
Version Control System
Distributed Version Control with git
LECTURE 3: Software Configuration Management
Version Control System - Git
Git started with git: 2018 edition
Systems Analysis and Design I
Presentation transcript:

Version Control and SVN ECE 297

Why Do We Need Version Control?

3 What’s the Problem? (1) edits builds prog.exe tests File1.cpp File2.cpp File1.h File2.h What if prog.exe is now broken? What if you made many changes before figuring out it was broken? 1. Need a way to go back to a previous version of the program

4 Any Simple Solution? Maybe just make a copy of all the files really often Then switch to a backup copy whenever you do something wrong Problems: –How often will you copy all the files? Every 5 minutes? Could get big! –If something goes wrong, how will you know which backup copy you should go back to  you may have thousands! –Will you forget/get bored and not back-up the files for a while (a day? a week? a month?)

5 What’s the Problem? (2) edits builds tests File1.cpp File2.cpp File1.h File2.h edits prog.exe What the? Batman overwrote my changes! 2. Need a way to prevent conflicting edits to a file saves

6 Any Simple Solution? Maybe call or other developers whenever you start editing a file –“Nobody edit file1.cpp  I’m editing it” Then send another when you’re done –“OK to edit file1.cpp again” Many problems –I didn’t read the –We both send about file1.cpp at the same time –Won’t scale to many developers

7 What’s the Problem? (3) edits builds tests File1.cpp File2.cpp File1.h File2.h edits prog.exe Ugh! Half complete Batman stuff is in my tests! 3. Need to control when our changes become visible to others saves

The Solution: A Version Control System Our choice: Subversion (aka SVN)

9 Key idea: local copies, global master Tony’s working copy Bruce’s working copy svn repository svn commands to interact svn commands to interact

How Does this Solve Problem 3? Controlling when my changes become visible to others and their changes become visible to me

11 Problem 3: Control When Others’ Changes Visible svn repository builds tests prog.exe builds tests prog.exe Work on your own (working) copy. Change, build, test with no interference from others

12 Problem 3: Control When Others’ Changes Visible svn repository svn commit When your changes are finished and fully tested, commit them to the central repository (like publishing them)

13 Problem 3: Control When Others’ Changes Visible svn repository svn update Get all committed changes from others when it is a natural / convenient  usually when you’ve already committed all your changes and want to start working on something new

14 Problem 3: Control When Others’ Changes Visible svn repository svn update Some chance that your changes plus those of others don’t work together builds tests prog.exe builds tests prog.exe  Always re-build and re-test right after an SVN update Fix any integration errors / bugs right away svn commit & svn update frequently -- many small integrations easier to debug than one huge one

How Does this Solve Problem 1? Need to be able to go back to a previous version of the program

16 Problem 1: Revision History & Reverting Changes svn repository svn commit Each commit creates a new revision  older versions of the program still exist r1 r2 r3

17 Problem 1: Revision History & Reverting Changes svn repository r1 r2 r3 Last revision is called head revision By default, svn update updates your files to match it svn update

18 Problem 1: Revision History & Reverting Changes svn repository r1 r2 r3 svn update builds prog.exe tests Tests fail: I blame Batman!

19 Problem 1: Revision History & Reverting Changes svn repository r1 r2 r3 svn update -r 2 builds prog.exe tests OK now  Batman and tell him to fix his committed code

20 Problem 1: Revision History & Reverting Changes o svn repository r1 r2 r3 svn log What went wrong? or Netbeans: search history Shows list of files modified by every commit, and message for each commit  make these messages meaningful!

21 Problem 1: Revision History & Reverting Changes o svn repository r1 r2 r3 svn diff –r2 file2.cpp What went wrong? Can see what the change was to file2.cpp in revision 2. Maybe it was Tony’s bad? Netbeans: much easier to use; just click on what diff you want Can use svn revert to back out of bad changes (working copy or committed)

22 svn diff (Using NetBeans)

23 Doesn’t This Still Take Lots of Storage? No, only changes stored between revisions Even for huge programs, changes between revisions are small –If you are using svn properly and committing often!

How Does this Solve Problem 2? Prevent Conflicting Edits to a File by Different People

25 Two Basic Approaches Lock-based –Don’t let two people work on the same file at the same time –Used by older systems (rcs, pvcs) –Friends don’t let friends use these systems! Merge-based –Many people can modify the same file independently in their working copies –Sort out what to put in the repository only when each person commits –Used by modern / good systems (svn, git)

26 Problem 2: Conflicting Edits svn repository svn commit r1 r2 “working copy is out of date” based on r1

27 Problem 2: Conflicting Edits svn repository svn update r1 r2 based on r1 builds tests prog.exe based on r2

28 Problem 2: Conflicting Edits svn repository r1 r2 based on r1 based on r2 svn commit r3

29 What If Two People Modified the Same File? svn repository r1 r2 based on r1 svn commit “working copy is out of date”

30 What If Two People Modified the Same File? svn repository r1 r2 based on r1 svn update Each modified different lines  all OK! svn merges changes automatically

31 What If Two People Modified the Same File? svn repository r1 r2 based on r1 svn update What if some lines in same file were modified by 2 people? conflict: you must tell svn how to resolve svn resolve or NetBeans GUI (much easier!)

32 NetBeans Merge Tool Pick which version you want for conflicting lines Can also directly edit the merged file Once conflicts are resolved (you have made a merged file), you can svn commit To minimize conflicts, try to divide work between team members so you are usually working on different things (different features  different files or file sections)

33 SVN Workflow Overview Once for milestone0 Once per team for milestone1 Once per team member for milestone1 2 Many, many times!

Branching More Advanced Feature Not Required for this course but may be useful

35 Branching Tony Stark is finishing off milestone 1 –Working, he’s just fixing a few last bugs Bruce Wayne wants to start work on milestone 2 –But we don’t want him breaking anything now  not much time to fix for milestone 1 submission! Solution: branch

36 SVN Branching SVN commands svn copy repos/proj/trunk repos/proj/m1_branch svn checkout repos/proj/m1_branch … work normally … Tony now working on the branch r101 r100r99 r102 r103 r104 trunk (for m2) repos/proj/trunk branch (for m1) repos/proj/m1_branch r105 r106 Nothing special about these names; just two lines of development now root directory of the main (trunk) code  original repo in our case new copy of all files in repository  use for branch Set your working copy to the branch Time

37 Bug fixes on Trunk and Branch The more the trunk and branch code have diverged the higher the probability of conflicts and manual effort with svn merge r101 r100r99 r102 r103 r104 trunk (for m2) repos/proj/trunk branch (for m1) repos/proj/m1_branch r105 r106 key bug fixed  want to fix on trunk too! Use svn merge command r107 svn merge

38 Releasing Large Software Systems  Stabilization and review on branch  Before you release the final executable to customers  Don’t want new features coded & integrated during this time  New development goes on trunk  Can work/commit changes (revisions) to either branch or trunk  Parallel evolutionary paths for the software How early to branch? –Sooner: more time for stabilization –But you have to fix bugs in two places –Altera: branch 3 months before release Gives a long time to stabilize But extra work to fix bugs found in branch in 2 places for 3 months My preference: branch late –Less time for stabilization, but less duplicate work

39 References 297 svn quick start guide –Read it all and do the embedded tutorial –Don’t need to read for this course, but useful detailed reference