Version Control with Subversion



Similar documents
CSCB07 Software Design Version Control

CISC 275: Introduction to Software Engineering. Lab 5: Introduction to Revision Control with. Charlie Greenbacker University of Delaware Fall 2011

Revision control systems (RCS) and

Version control. HEAD is the name of the latest revision in the repository. It can be used in subversion rather than the latest revision number.

Subversion Integration for Visual Studio

Version Control. Luka Milovanov

CSE 374 Programming Concepts & Tools. Laura Campbell (Thanks to Hal Perkins) Winter 2014 Lecture 16 Version control and svn

Version control with Subversion

Version Control with Svn, Git and git-svn. Kate Hedstrom ARSC, UAF

Source Control Systems

UNIVERSITY OF CALIFORNIA Department of Electrical Engineering and Computer Sciences Computer Science Division. P. N. Hilfinger

Version Control with Subversion

Version Control with Subversion and Xcode

[PRAKTISCHE ASPEKTE DER INFORMATIK WS 13/14]

Xcode Source Management Guide. (Legacy)

Introduction to Subversion

Using SVN to Manage Source RTL

Using Subversion in Computer Science

Version Control Using Subversion. Version Control Using Subversion 1 / 27

Managing Source Code With Subversion

Version Control Script

Using SVN to Manage Source RTL

Introduction to Version Control in

SVN Setup and Configuration Management

Version Control! Scenarios, Working with Git!

Ingeniørh. Version Control also known as Configuration Management

Introduction to Source Control ---

CS 2112 Lab: Version Control

Subversion Server for Windows

Version Control with. Ben Morgan

Version Control Tutorial using TortoiseSVN and. TortoiseGit

Subversion. Nadir SOUALEM. Linux Users subversion client svn or higher. Windows users subversion client Tortoise 1.6.

MATLAB & Git Versioning: The Very Basics

Introduction to Git. Markus Kötter Notes. Leinelab Workshop July 28, 2015

Version Control with Git. Kate Hedstrom ARSC, UAF

CPSC 491. Today: Source code control. Source Code (Version) Control. Exercise: g., no git, subversion, cvs, etc.)

using version control in system administration

Introduction to Programming Tools. Anjana & Shankar September,2010

Git Basics. Christopher Simpkins Chris Simpkins (Georgia Tech) CS 2340 Objects and Design CS / 22

Google Cloud Print Setup. User s Guide

Advanced Computing Tools for Applied Research Chapter 4. Version control

Source Control and Team-Based Design in System Generator Author: Douang Phanthavong

Managing Software Projects Like a Boss with Subversion and Trac

Version Control Systems

INF 111 / CSE 121. Homework 4: Subversion Due Tuesday, July 14, 2009

Version Control with Git. Dylan Nugent

Source Control Guide: Git

BlueJ Teamwork Tutorial

Introduction to the Git Version Control System

Software Delivery Integration and Source Code Management. for Suppliers

Version control. with git and GitHub. Karl Broman. Biostatistics & Medical Informatics, UW Madison

Integrate Rails into an Existing IIS Web infrastructure using Mongrel

Healthstone Monitoring System

The Einstein Depot server

Work. MATLAB Source Control Using Git

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer

An Introduction to Mercurial Version Control Software

EAE-MS SCCAPI based Version Control System

Fritz Speed Documentation

Mercurial. Why version control (Single users)

Modulo II Software Configuration Management - SCM

PRESENTS... Reasons to Switch from SourceSafe: How to Make Your Life Easier with SourceAnywhere Standalone

MultiValue Dashboard. Installation Guide

Continuous Integration. CSC 440: Software Engineering Slide #1

Setting up a local working copy with SVN, MAMP and rsync. Agentic

OpenDJ LDAP SDK Release Notes

QlikView 11 Source Control Walkthrough

Digger Solutions. Intranet Open Source. Administrator s Guide

Beginning with SubclipseSVN

TIBCO Spotfire Server Migration. Migration Manual

Linux Overview. Local facilities. Linux commands. The vi (gvim) editor

FEEG Applied Programming 3 - Version Control and Git II

docs.hortonworks.com

Source Code Management/Version Control

Using Git for Project Management with µvision

Zero-Touch Drupal Deployment

SVN Starter s Guide Compiled by Pearl Guterman June 2005

PxPlus Version Control System Using TortoiseSVN. Jane Raymond

Two Best Practices for Scientific Computing

Source code management systems

Manual. CollabNet Subversion Connector to HP Quality Center. Version 1.2

Version control tracks multiple versions. Configuration Management. Version Control. V Software Engineering Lecture 12, Spring 2008

Hyper V Windows 2012 and 8. Virtual LoadMaster for Microsoft Hyper V on Windows Server 2012, 2012 R2 and Windows 8. Installation Guide

Using Network Attached Storage with Linux. by Andy Pepperdine

Version Control with Git. Linux Users Group UT Arlington. Rohit Rawat

Transcription:

Version Control with Subversion http://www.oit.duke.edu/scsc/ http://wiki.duke.edu/display/scsc scsc@duke.edu John Pormann, Ph.D. jbp1@duke.edu Software Carpentry Courseware This is a re-work from the Software Carpentry Coursework: Python Software Foundation, Greg Wilson http://www.swc.scipy.org/ http://www.swc.scipy.org/lec/version.html Copyright (C) 2005-06 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.

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

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)

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

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

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 https://server.duke.edu/path/to/svn... 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

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

Resolving a Conflict Subversion puts Hermione's changes and Ron's in moons.txt Adds conflict markers to show where they overlapped Callisto 1882.7 16.689018 <<<<<<<.mine Amalthea 181.4 0.498179 Lysithea 11720 259.22 ======= Amalthea 181.4 0.579234 Elara 11740 259.6528 >>>>>>>.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)

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

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 http://www.hogwarts.edu/svn/rotor! 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

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.

Check out the rest of the Software Carpentry site http://www.swc.scipy.org/ 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