Version Control with Subversion

Transcription

1 Version Control with Subversion John Pormann, Ph.D. Software Carpentry Courseware This is a re-work from the Software Carpentry Coursework: Python Software Foundation, Greg Wilson Copyright (C) Python Software Foundation Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:the above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

2 Collaboration on Software What if two or more people want to edit the same file at the same time? Option 1: make them take turns But then only one person can be working at any time And how do you enforce the rule? Option 2: patch up differences afterwards Requires a lot of re-working Stuff always gets lost Version Control The right solution is to use a version control system Keep the master copy of the file in a central repository Each author edits a working copy When they're ready to share their changes, they commit them to the repository Other people can then do an update to get those changes

3 Version Control, cont d What if it s just ME? This is also a good way for one person to manage files on multiple machines Keep one working copy on your personal laptop, the lab machine, and the departmental server No more mailing yourself files, or carrying around a USB drive (and forgetting to copy things onto it)

4 Change Management Often want to undo changes to a file Start work, realize it's the wrong approach, want to get back to starting point Like undo in an editor but keep the whole history of every file, forever Also want to be able to see who changed what, when The best way to find out how something works is often to ask the person who wrote it Version Control, cont d Have the version control system keep old revisions of files And have it record who made the change, and when Authors can then roll back to a particular revision or time

5 Subversion, Basic Use Ron and Hermione each has a working copy of the solarsystem project repository Ron wants to add some information about Jupiter's moons Runs svn update to synchronize his working copy with the repository Goes into the jupiter directory and creates moons.txt Runs svn add moons.txt to bring it to Subversion's notice Runs svn commit to save his changes in the repository Repository is now at revision 121 That afternoon, Hermione runs svn update on her working copy Subversion sends her Ron's changes Basic Use, cont d

6 How to do it? One way to use Subversion is to type commands in a shell A lowest common denominator that will work almost everywhere % svn checkout asks for password... % svn add file.c % svn commit... asks for log message... % svn update RapidSVN is a GUI that runs on Windows, Linux, and Mac Well, maybe walks is a better description Version 0.9 isn't particularly fast TortoiseSVN is a Windows shell extension Integrates with the file browser, rather than running separately Resolving Conflicts Back to the problem of conflicting edits (or, more simply, conflicts) Option 1: only allow one person to have a writeable copy at any time This is called pessimistic concurrency Used in Microsoft Visual SourceSafe Option 2: let people edit, and resolve conflicts afterward by merging files Called optimistic concurrency It's easier to get forgiveness than permission Most modern systems (including Subversion) do this

7 Conflicts, cont d Ron and Hermione are both synchronized with version 151 of the repository Ron edits moons.txt and commits his changes to create version 152 Simultaneously, Hermione edits her copy of moons.txt When she tries to commit, Subversion tells her there's a conflict A race condition: two or more would-be writers racing to get their changes in first Conflicts, cont d

8 Resolving a Conflict Subversion puts Hermione's changes and Ron's in moons.txt Adds conflict markers to show where they overlapped Callisto <<<<<<<.mine Amalthea Lysithea ======= Amalthea Elara >>>>>>>.r152 <<<<<<< shows the start of the section from the first file ======= divides sections >>>>>>> shows the end of the section from the second file Subversion also creates: moons.txt.mine: contains Hermione's changes moons.txt.151: the file before either set of changes moons.txt.152: the most recent version of the file in the repository Resolving, cont d At this point, Hermione can: Run svn revert moons.txt to throw away her changes Copy one of the three temporary files on top of moons.txt Edit moons.txt to remove the conflict markers Once she's done, she runs: svn resolved moons.txt to let Subversion know she's done svn commit to commit her changes (creating version 153 of the repository)

9 Reverting Changes After doing some more work, Ron decides he's on the wrong path svn diff shows him which files he has changed, and what those changes are He hasn't committed anything yet, so he uses svn revert to discard his work I.e., throw away any differences between his working copy and the master as it was when he started Synchronizes with where he was, not with any changes other people have made since then If you find yourself reverting repeatedly, you should probably go and do something else for a while Rolling Back a Change Now Ron decides that he doesn't like the changes Harry just made to moons.txt Wants to do the equivalent of undo svn log shows recent history Current revision is 157 He wants to revert to revision 156 svn merge -r 157:156 moons.txt will do the trick The argument to the -r flag specifies the revisions involved Merging allows him to keep some of Harry's changes if he wants to Revision 157 is still in the repository

10 Rolling Back, cont d Creating a Repository This is best done by your local sys admin!! To create a repository: Decide where to put it (e.g., /svn/rotor) cd /svn svnadmin create rotor Can then check out a working copy Directly through the file system:! svn checkout file:///svn/rotor Through a web server:! svn checkout Note: requires your system administrator to configure the web server properly Only use svn checkout once, to initialize your working copy After that, use svn update in that directory Ask your local sys admin about a WebDAV server for Subversion

11 Subversion Status svn status compares your working copy with the repository Prints one line for each file that's worth talking about % svn status M jupiter/moons.txt C readme.txt M = modified, C = conflicts svn update prints one line for each file or directory it does something to % svn update A saturn/moons.txt U mars/mars.txt A = added (new file), U = updated (changed) Subversion Command Reference svn add new.c Add files and/or directories to version control. svn checkout url Get a fresh working copy of a repository. svn commit Send changes from working copy to repository. svn delete old.c Delete files and/or directories from version control. svn diff one Show differences between current file and repository. svn help cmd Get help (in general, or for a particular command). svn log Show history of recent changes. svn merge -r 18:16 spin.c Merge two different versions of a file into one. svn mkdir dir Create a new directory and put it under version control. svn rename old new Rename a file or directory, keeping track of history. svn revert file.c Undo changes to working copy (i.e., resync with repository). svn status Show the status of files/directories in the working copy. svn update Bring changes from repository into working copy.

12 Check out the rest of the Software Carpentry site I highly recommend going through the whole set of pages!! Covers a lot of the non-classroom sides of software development 26 s/w dev pages plus some references and URLs Some great tools exist to make building software easier and less error prone... take advantage of them! What is Version Control? A version control system allows you to commit changes in your source code (or any file) to a repository That repository stores all past versions of the code and allows you to roll back to a previous version The repository can share your code with other people; and it will manage everyone s changes so that they don t overwrite each other YOU must commit the changes manually Every time you ve made a significant change to the code? Once per night? The repository will ask for a log message to help track why the source code was changed Bug fix New feature Speed optimization

CSCB07 Software Design Version Control Anya Tafliovich Fall 2015 Problem I: Working Solo How do you keep track of changes to your program? Option 1: Don t bother Hope you get it right the first time Hope

Version control Version control is a powerful tool for many kinds of work done over a period of time, including writing papers and theses as well as writing code. This session gives a introduction to a

Revision control systems (RCS) and Subversion Problem area Software projects with multiple developers need to coordinate and synchronize the source code Approaches to version control Work on same computer

Version Control Luka Milovanov lmilovan@abo.fi Configuration Management Configuration management is the management of system change to software products Version management: consistent scheme of version

1 Version Control with Svn, Git and git-svn Kate Hedstrom ARSC, UAF 2 Version Control Software System for managing source files For groups of people working on the same code When you need to get back last

Version Control with Subversion Introduction Wouldn t you like to have a time machine? Software developers already have one! it is called version control Version control (aka Revision Control System or

Version Control with Subversion and Xcode Author: Mark Szymczyk Last Update: June 21, 2006 This article shows you how to place your source code files under version control using Subversion and Xcode. By

2013/14 Institut für Computergraphik, TU Braunschweig Pablo Bauszat [PRAKTISCHE ASPEKTE DER INFORMATIK WS 13/14] All elemental steps that will get you started for your new life as a computer science programmer.

TortoiseSVN A Subversion client for Windows Version 1.4.5 Installing TortoiseSVN Click here to download the latest version of the Installer of 32bit TortoiseSVN Or Copy/paste the following link to your

Introduction to Subversion Getting started with svn Matteo Vescovi 19/02/2010 Agenda A little bit of theory Overview of Subversion Subversion approach to Version Control Using Subversion Typical subversion

Flumes Short User Guide to Subversion Peter Nordin January 7, 2014 This guide is primarily meant as an introduction to Subversion for users of the svn accounts administered by the Division of Fluid and

Introduction to Version Control in In you can use Version Control to work with different versions of database objects and to keep the database updated. You can review, manage, compare, and revert to any

Principles of Software Construction: Objects, Design, and Concurrency Version Control Jonathan Aldrich Charlie Garrod School of Computer Science Based on slides by Christian Kästner 1 Administrivia Extra

School of Computer Science 1 Using Subversion in Computer Science Last modified July 28, 2006 Starting from semester two, the School is adopting the increasingly popular SVN system for management of student

Using SVN to Manage Source RTL CS250 Tutorial 1 (Version 083010a) August 30, 2010 Yunsup Lee In this tutorial you will gain experience using the Subversion (SVN) to manage your source RTL and code. You

Version Control Script Mike Jackson, The Software Sustainability Institute Things you should do are written in bold. Suggested dialog is in normal text. Command- line excerpts and code fragments are in

Version Control Using Subversion Version Control Using Subversion 1 / 27 What Is Version Control? Version control is also known as revision control. Version control is provided by a version control system

Ingeniørh rhøjskolen i Århus Version Control also known as Configuration Management Why version control? Teamwork You work in a team. You open a file and start work on it. Your colleague opens a file and

29 September 1 October, 2014 Version Control What is Version Control? You re emailing your project back and forth with your partner. An hour before the deadline, you and your partner both find different

Lab Handout ENGI3891 Faculty of Engineering and Applied Science 16,23 Sep 2015 1 Purpose and outcomes This lab will give you hands-on experience with an essential development tool: a version control system

SubVersioN the new Central Service at DESY by Marian Gawron What is Subversion? Revision Control System made to replace CVS SVN Basics Client Options Svnserve Command line client Different GUIs for Windows,

Version Control and Subversion Dr Paul Tennent Outline Housekeeping What is Version Control? Why use it? Using Subversion (SVN) Housekeeping You know where to find everything http://www.cs.nott.ax.uk/~pxt/g52grp

The Bazaar Version Control System Michael Hudson, Canonical Ltd michael.hudson@canonical.com What is Bazaar? Bazaar is a Distributed Version Control System (DVCS) You probably know what a VCS is by now:

Today: Source code control CPSC 491 Source Code (Version) Control Exercise: 1. Pretend like you don t have a version control system (e. g., no git, subversion, cvs, etc.) 2. How would you manage your source

i i Systems and Internet Infrastructure Security Institute for Networking and Security Research Department of Computer Science and Engineering Pennsylvania State University, University Park, PA Version

Version Control Tutorial using TortoiseSVN and TortoiseGit Christopher J. Roy, Associate Professor Virginia Tech, cjroy@vt.edu This tutorial can be found at: www.aoe.vt.edu/people/webpages/cjroy/software-resources/tortoise-svn-git-tutorial.pdf

This article will walk you through the steps of installing Ruby, Gems, Rails, and other important libraries on a Windows 2003 server with IIS. Microsoft s Internet Information Server is a popular proprietary

Advanced Computing Tools for Applied Research Jaime Boal Martín-Larrauri Rafael Palacios Hielscher Academic year 2014/2015 1 Version control fundamentals 2 What you probably do now Manually save copies

1 MATLAB & Git Versioning: The Very Basics basic guide for using git (command line) in the development of MATLAB code (windows) The information for this small guide was taken from the following websites:

1 Version Control with Git Kate Hedstrom ARSC, UAF Linus Torvalds 3 Version Control Software System for managing source files For groups of people working on the same code When you need to get back last

Using the Vision Lab s SVN server Robert Sekuler February 8, 2008 This document introduces the reader to the lab s version control system, which is hosted on one of Brandeis servers. Our version control

EAE-MS SCCAPI based Version Control System This document is an implementation guide to use the EAE-MS SCCAPI based Version Control System as an alternative to the existing EAE Version Control System. The

1 SUBVERSION A version control tool OUTLINE What is subversion? Basic commands help Import Checkout what is.svn directory? update other commands status diff log links 2 WHAT IS SUBVERSION? Subversion is

Homework 4: Subversion Due Tuesday, July 14, 2009 Name : Student Number : Laboratory Time : Objectives Preamble Set up a Subversion repository on UNIX Use Eclipse as a Subversion client Subversion (SVN)

Version Control Tutorial using TortoiseSVN Christopher J. Roy, Associate Professor Virginia Tech, cjroy@vt.edu This tutorial can be found at: www.aoe.vt.edu/~cjroy/misc/tortoisesvn-tutorial.pdf In software

Introduction to the Sebastian Rockel rockel@informatik.uni-hamburg.de University of Hamburg Faculty of Mathematics, Informatics and Natural Sciences Department of Informatics Technical Aspects of Multimodal

MadCap Software Source Control Guide: Git Flare 11.1 Copyright 2015 MadCap Software. All rights reserved. Information in this document is subject to change without notice. The software described in this

Standalone PRESENTS... Reasons to Switch from SourceSafe: How to Make Your Life Easier with SourceAnywhere Standalone Most developers are familiar with Visual SourceSafe. It's a popular version control

Hosted PRESENTS... Reasons to Switch from SourceSafe: Why SourceAnywhere Hosted Makes Life Easier for Systems Administrators and Developers Maintaining a version control system is resource intensive. Look

MATLAB @ Work MATLAB Source Control Using Git Richard Johnson Using source control is a key practice for professional programmers. If you have ever broken a program with a lot of editing changes, you can

The Einstein Depot server Have you ever needed a way to transfer large files to colleagues? Or allow a colleague to send large files to you? Do you need to transfer files that are too big to be sent as

Digger Solutions Intranet Open Source Administrator s Guide Hello and welcome to your new Intranet! Welcome to Digger Solutions Intranet Open Source. If you have any questions please review the product

About the Tutorial Apache Subversion which is often abbreviated as SVN, is a software versioning and revision control system distributed under an open source license. Subversion was created by CollabNet

COSC345 2013 Software Engineering Lecture 7: Version Control Some Problems Communications File system problems Version control Basic principles and use Outline When to use version control Examples SCCS

PxPlus Version Control System Using TortoiseSVN Presented by: Jane Raymond Presentation Outline Basic installation and setup Checking in an application first time Checking out an application first time

Configuration Management Version Control V22.0474-001 Software Engineering Lecture 12, Spring 2008 Clark Barrett, New York University Configuration Management refers to a set of procedures for managing

Two Best Practices for Scientific Computing Version Control Systems & Automated Code Testing David Love Software Interest Group University of Arizona February 18, 2013 How This Talk Happened Applied alumnus,

Setting up a local working copy with SVN, MAMP and rsync Agentic - 2009 Get MAMP You can download MAMP for MAC at this address : http://www.mamp.info/en/downloads/index.html Install MAMP in your APPLICATION

CVS SUITE QUICK GUIDE 2009 Build 3701 February 2010 March Hare Software Ltd Legal Notices Legal Notices There are various product or company names used herein that are the trademarks, service marks, or

Version Control Key Points ========================== Mike Jackson, The Software Sustainability Institute. This work is licensed under the Creative Commons Attribution License. Copyright (c) Software Carpentry

Linux Overview Local facilities Linux commands The vi (gvim) editor MobiLan This system consists of a number of laptop computers (Windows) connected to a wireless Local Area Network. You need to be careful

FEEG6002 - Applied Programming 3 - Version Control and Git II Sam Sinayoko 2015-10-16 1 / 26 Outline Learning outcomes Working with a single repository (review) Working with multiple versions of a repository

Source code management systems SVN, Git, Mercurial, Bazaar,... for managing large projects with multiple people work locally or across a network store and retrieve all versions of all directories and files