Using Subversion for Source Code Control

Similar documents
Versioning. Jurriaan Hage homepage: Slides stolen from Eelco Dolstra.

Subversion FOUR. 4.1 What is Version Control? 4.2 What is Subversion? Types of Version Control SESSION

Common Configuration Management Tasks: How to Do Them with Subversion

Department of Computer Science College of Engineering Boise State University

[Software Development] Development Tools. Davide Balzarotti. Eurecom Sophia Antipolis, France

Exercise 1: Basic Tools

Introduction to Supercomputing

Version Control. Version Control

Revision Control II. - svn

Revision Control and GIT

CSCI 2132: Software Development. Norbert Zeh. Faculty of Computer Science Dalhousie University. Subversion (and Git) Winter 2019

Introduction to Supercomputing

Using Subversion with LeMANS and MONACO

CS480. Compilers Eclipse, SVN, Makefile examples

Chapter 3. Revision Control

CSE 374 Programming Concepts & Tools. Hal Perkins Winter 2012 Lecture 16 Version control and svn

COSC345 Software Engineering. Version Control

CSCI 4152/6509 Natural Language Processing. Lab 1: FCS Computing Environment

Warmup. A programmer s wife tells him, Would you mind going to the store and picking up a loaf of bread? Also, if they have eggs, get a dozen.

TDDC88 Lab 4 Software Configuration Management

Version Control Systems

How to version control like a pro: a roadmap to your reproducible & collaborative research

Revision control systems (RCS) and. Subversion

Introduction to Revision Control

Submitting your Work using GIT

What is Subversion and what does it do?

Version Control Systems (VCS)

Revision control. INF5750/ Lecture 2 (Part I)

Section 2: Developer tools and you. Alex Mariakakis (staff-wide)

CS631 - Advanced Programming in the UNIX Environment. UNIX development tools

Version control with RCS and CVS An introduction. Markus Bjartveit Krüger

Systems Programming Advanced Software Development

Development tools: Version control, build tools, and integrated development environments 1

Working with GIT. Florido Paganelli Lund University MNXB Florido Paganelli MNXB Working with git 1/47

CS108, Stanford Handout #37. Source Control CVS

Using Git to Manage Source RTL

CS 261 Recitation 1 Compiling C on UNIX

A Short Introduction to Subversion

An Introduction to Subversion

Source Code Management

Manage quality processes with Bugzilla

CS2720 Practical Software Development

Tutorial 2 GitHub Tutorial

A BASIC UNDERSTANDING OF VERSION CONTROL

Hand-on Labs for Chapter 1 and Appendix A CSCE 212 Introduction to Computer Architecture, Spring

CSC 2700: Scientific Computing

February 2 nd Jean Parpaillon

Tools for software development:

Beyond this course. Machine code. Readings: CP:AMA 2.1, 15.4

Revision Control. An Introduction Using Git 1/15

2/8/18. Overview. Project Management. The First Law. What is Project Management? What Are These Changes? Software Configuration Management (SCM)

Version Control. Version Control

Project Management. Overview

Version Control Systems (Part 1)

Subversion. CS 490MT/5555, Fall 2015, Yongjie Zheng

AMath 483/583 Lecture 2

AMath 483/583 Lecture 2. Notes: Notes: Homework #1. Class Virtual Machine. Notes: Outline:

CPSC 491. Lecture 19 & 20: Source Code Version Control. VCS = Version Control Software SCM = Source Code Management

VSO. Configuration Management

Git. CSCI 5828: Foundations of Software Engineering Lecture 02a 08/27/2015

Next Generation Software Configuration Management with Subversion

Introduction to Git and GitHub for Writers Workbook February 23, 2019 Peter Gruenbaum

SECTION 2: CODE REASONING + PROGRAMMING TOOLS. slides borrowed and adapted from Alex Mariakis and CSE 390a

MNXB Working with SVN. Florido Paganelli Lund University Tutorial 2b

Managing Source Code With Subversion

A quick (and maybe practical) guide to Git and version control. By Jay Johnson

Introduction to Version Control

Version Control. 1 Version Control Systems. Ken Bloom. Linux User Group of Davis March 1, 2005

Common Git Commands. Git Crash Course. Teon Banek April 7, Teon Banek (TakeLab) Common Git Commands TakeLab 1 / 18

Systems Software. Recitation 1: Intro & Revision Control. Quite different from 213. Our Philosophy. Partly-free lunch

PRINCIPLES OF OPERATING SYSTEMS

COMP s1 Lecture 1

History of the development of Lua

Computational Physics Compiling a C++ program

CSCI 2132 Software Development. Lecture 5: File Permissions

2 Compiling a C program

Use git rm to remove files from workspace

Chapter 2. Basics of Program Writing

CSE 160: Introduction to Parallel Computation

Computer Labs: Version Control with Subversion

Git. Charles J. Geyer School of Statistics University of Minnesota. Stat 8054 Lecture Notes

Git. SSE2034: System Software Experiment 3, Fall 2018, Jinkyu Jeong

Decentralized Version Control Systems

27-Sep CSCI 2132 Software Development Lab 4: Exploring bash and C Compilation. Faculty of Computer Science, Dalhousie University

Git tutorial. Katie Osterried C2SM. October 22, 2015

Getting started with UNIX/Linux for G51PRG and G51CSA

Collaborative Design with Oracle SQL Developer Data Modeler

Software Development I

Introduction to Linux

Welcome! Virtual tutorial starts at 15:00 GMT. Please leave feedback afterwards at:

Version Control System. -- base on Subversion 1.4

Git for Newbies. ComMouse Dongyue Studio

Eclipse/Subversion/Linux Script Complete before Wednesday!

Multicore Programming Handout 1: Installing GCC Cilk Plus

Software Tools Subversion

Subversion Repository Layout

Intro to Linux & Command Line

Software Development. Hack, hack, hack, hack, hack. Sorta works. Main.c. COMP s1

Version Control Systems: Overview

Portions adapted from A Visual Guide to Version Control. Introduction to CVS

Transcription:

Using Subversion for Source Code Control Derrick Kearney HUBzero Platform for Scientific Collaboration Purdue University Original slides by Michael McLennan This work licensed under Creative Commons See license online: by-nc-sa/3.0

What is Subversion? CVS on steroids Created by developers at CollabNet In development since 2000 In production (version 1.0) since Feb 2004 Open source (Apache/BSD-style license) Unix/Linux, Win32, BeOS, OS/2, MacOS X Home page: http://subversion.tigris.org/ Client/Server model: Upload: add/commit Subversion repository Clients Download: checkout Server

Why bother with Subversion? Does this sound familiar? x2.1 x2.2 x2 x1 x2 x3 working test NCSA hamlet x3.1a output x2 output v1 = 3.125 v2 = 9.987 x3.1 CPU: 420s v1 = 3.12498 v2 = 9.9901? CPU: 340s

Top 5: Why you should use Subversion It s easy to learn A little simpler than Git You ll feel more secure SSL transport between client/server; repository is backed up Where did I put that SSL It s in the repository Subversion repository Who broke the build? Look at the revision history Your hard drive just died No problem, your code is in the repository NCSA carter 4

Getting Started trunk branches yourtool Once you register your tool, your repository is created automatically tags Subversion repository

Check out your code svn checkout https://nanohub.org/tools/yourtool/svn/trunk yourtool A yourtool/rappture A yourtool/doc A yourtool/src A yourtool/bin A yourtool/data A yourtool/middleware A yourtool/examples Checked out revision 1. mkdir examples/ex1 vi examples/ex1/readme svn add examples/ex1 A examples/ex1 A examples/ex1/readme Instructions in your project area at wiki/gettingstarted From any machine

Commit your changes cd yourtool commit at the top level, so you don t svn status A examples/ex1 A examples/ex1/readme? a.out brings up your favorite editor: miss anything Created ex1 directory and added the README file. --This line, and those below, will be ignored-a A examples/ex1 examples/ex1/readme svn commit Adding examples/ex1 Adding examples/ex1/readme Transmitting file data. Committed revision 2. Instructions in your project area at wiki/gettingstarted

What about Windows? More info: http://tortoisesvn.net Puts svn commands onto the right-mouse-button menu: Like any other file on your Desktop, but icon shows Subversion control

Moving and removing files cd examples/ex1 svn mv README README.txt A README.txt D README brings cd../.. svn delete doc D doc up your favorite editor: Moved some files around. --This line, and those below, will be ignored-- D doc svn status A examples/ex1/readme.txt D doc D examples/ex1/readme A + examples/ex1/readme.txt D examples/ex1/readme svn commit What are these secret codes? See this page. http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html

Editing and updating edit: Makefile svn commit svn commit svn update gcc -g hello.c gcc -O hello.c gcc -O hello.c svn checkout https://nanohub.org/tools/yourtool/svn/trunk yourtool Copy code around Move code to new machines with svn checkout Move changes around with svn commit and svn update

Looking for differences and reverting svn status M src/hello.c svn diff src/hello.c Index: src/hello.c ===================================== --- src/hello.c (revision 4) +++ src/hello.c (working copy) @@ -4,6 +4,7 @@ int main(int argc, char **argv) { - printf("hello, World!\n"); + /* say hello to everyone */ + printf("hello, Universe!\n"); exit(0); } Can also revert directory changes (adding/deleting files) svn revert hello.c Reverted 'hello.c'

Merging changes edit: Makefile gcc O hello.c clean: rm f *.o a.out svn commit CC=gcc $(CC) -O hello.c Whoever checks in first has no problem Next svn update integrates compatible changes

Merging changes edit: Makefile gcc O hello.c clean: rm f *.o a.out CC=gcc $(CC) -O hello.c clean: rm f *.o a.out Whoever checks in first has no problem Next svn update integrates compatible changes Use svn commit to commit the merged changes svn update svn commit

Resolving merge conflicts edit: Makefile gcc O hello.c o hello clean: rm f *.o a.out svn commit CC=gcc $(CC) -O hello.c Whoever checks in first has no problem Next svn update integrates changes Problem here: both change the same line

Resolving merge conflicts svn update C Makefile Updated to revision 6. svn commit svn: Commit failed (details follow): svn: Aborting commit: 'Makefile' remains in conflict conflict! svn??? C status Makefile.r5 Makefile.r6 Makefile.mine Makefile best guess at integrated changes

Resolving merge conflicts vi Makefile CC=gcc <<<<<<<.mine $(CC) -O hello.c ======= gcc -O hello.c -o hello clean: rm -f *.o a.out >>>>>>>.r6

Resolving merge conflicts vi Makefile CC=gcc <<<<<<<.mine $(CC) -O hello.c ======= gcc -O hello.c -o hello clean: rm -f *.o a.out >>>>>>>.r6

Resolving merge conflicts vi Makefile CC=gcc $(CC) -O hello.c -o hello clean: rm -f *.o a.out.svn resolved Makefile Resolved conflicted state of 'Makefile' svn commit Sending src/makefile Transmitting file data. Committed revision 7

Retrieving an old version Get the whole distribution svn checkout r 3 https://nanohub.org/tools/yourtool/svn/trunk yourtool get revision 3 Get a particular file svn cat r 5 Makefile svn cat r 5 Makefile > Makefile show me revision 5 replace current file with revision 5 Which revision? svn log Makefile svn log show me revisions for this file show me revisions for current directory

Binary files Good defaults. Subversion usually does the right thing: cp diagram.jpg examples svn add examples/diagram.jpg A (bin) examples/diagram.jpg svn commit Adding (bin) examples/diagram.jpg Transmitting file data. Committed revision 8. Recognized as a binary file: no CR/LF translation no merges, only replacements When it fails, set properties yourself: cp demo.dat examples svn add examples/demo.dat A examples/demo.dat svn propset svn:mime-type application/octet-stream examples/demo.dat svn propdel svn:eol-style examples/demo.dat

More Information Web site: http://subversion.apache.org/ Subversion Book From O Reilly & Associates, and also online Quick-start guide for your project: https://nanohub.org/tools/yourtool/wiki/gettingstarted

Using Subversion for Source Code Control Derrick Kearney HUBzero Platform for Scientific Collaboration Purdue University Original slides by Michael McLennan This work licensed under Creative Commons See license online: by-nc-sa/3.0

What is Subversion? CVS on steroids Created by developers at CollabNet In development since 2000 In production (version 1.0) since Feb 2004 Open source (Apache/BSD-style license) Unix/Linux, Win32, BeOS, OS/2, MacOS X Home page: http://subversion.tigris.org/ Client/Server model: Upload: add/commit Subversion repository Clients Download: checkout Server

Why bother with Subversion? Does this sound familiar? x2.1 x2.2 x2 x1 x2 x3 working test hamlet NCSA x3.1a output x2 output v1 = 3.125 v2 = 9.987 x3.1 CPU: 420s v1 = 3.12498 v2 = 9.9901? CPU: 340s

Top 5: Why you should use Subversion It s easy to learn A little simpler than Git You ll feel more secure SSL transport between client/server; repository is backed up Where did I put that SSL It s in the repository Subversion repository Who broke the build? Look at the revision history Your hard drive just died No problem, your code is in the repository NCSA carter 4

Getting Started trunk branches yourtool Once you register your tool, your repository is created automatically tags Subversion repository

Check out your code svn checkout https://nanohub.org/tools/yourtool/svn/trunk yourtool A yourtool/rappture A yourtool/doc A yourtool/src A yourtool/bin A yourtool/data A yourtool/middleware A yourtool/examples Checked out revision 1. mkdir examples/ex1 vi examples/ex1/readme svn add examples/ex1 A examples/ex1 A examples/ex1/readme Instructions in your project area at wiki/gettingstarted From any machine

Commit your changes cd yourtool commit at the top level, so you don t svn status A examples/ex1 A examples/ex1/readme? a.out brings up your favorite editor: miss anything Created ex1 directory and added the README file. --This line, and those below, will be ignored-a examples/ex1 A examples/ex1/readme svn commit Adding examples/ex1 Adding examples/ex1/readme Transmitting file data. Committed revision 2. Instructions in your project area at wiki/gettingstarted

What about Windows? More info: http://tortoisesvn.net Puts svn commands onto the right-mouse-button menu: Like any other file on your Desktop, but icon shows Subversion control

Moving and removing files cd examples/ex1 svn mv README README.txt A README.txt D README brings cd../.. svn delete doc D doc up your favorite editor: Moved some files around. --This line, and those below, will be ignored-- D doc svn status A examples/ex1/readme.txt D doc D examples/ex1/readme A + examples/ex1/readme.txt D examples/ex1/readme svn commit What are these secret codes? See this page. http://svnbook.red-bean.com/en/1.7/svn.ref.svn.c.status.html

Editing and updating edit: Makefile svn commit svn commit svn update gcc -g hello.c gcc -O hello.c gcc -O hello.c svn checkout https://nanohub.org/tools/yourtool/svn/trunk yourtool Copy code around Move code to new machines with svn checkout Move changes around with svn commit and svn update

Looking for differences and reverting svn status M src/hello.c svn diff src/hello.c Index: src/hello.c ===================================== --- src/hello.c (revision 4) +++ src/hello.c (working copy) @@ -4,6 +4,7 @@ int main(int argc, char **argv) { - printf("hello, World!\n"); + /* say hello to everyone */ + printf("hello, Universe!\n"); exit(0); } Can also revert directory changes (adding/deleting files) svn revert hello.c Reverted 'hello.c'

Merging changes edit: Makefile gcc O hello.c clean: rm f *.o a.out svn commit CC=gcc $(CC) -O hello.c Whoever checks in first has no problem Next svn update integrates compatible changes

Merging changes edit: Makefile gcc O hello.c clean: rm f *.o a.out CC=gcc $(CC) -O hello.c clean: rm f *.o a.out Whoever checks in first has no problem Next svn update integrates compatible changes Use svn commit to commit the merged changes svn update svn commit

Resolving merge conflicts edit: Makefile gcc O hello.c o hello clean: rm f *.o a.out svn commit CC=gcc $(CC) -O hello.c Whoever checks in first has no problem Next svn update integrates changes Problem here: both change the same line

Resolving merge conflicts svn update C Makefile Updated to revision 6. svn commit svn: Commit failed (details follow): svn: Aborting commit: 'Makefile' remains in conflict conflict! svn??? C status Makefile.r5 Makefile.r6 Makefile.mine Makefile best guess at integrated changes

Resolving merge conflicts vi Makefile CC=gcc <<<<<<<.mine $(CC) -O hello.c ======= gcc -O hello.c -o hello clean: rm -f *.o a.out >>>>>>>.r6

Resolving merge conflicts vi Makefile CC=gcc <<<<<<<.mine $(CC) -O hello.c ======= gcc -O hello.c -o hello clean: rm -f *.o a.out >>>>>>>.r6

Resolving merge conflicts vi Makefile CC=gcc $(CC) -O hello.c -o hello clean: rm -f *.o a.out.svn resolved Makefile Resolved conflicted state of 'Makefile' svn commit Sending src/makefile Transmitting file data. Committed revision 7

Retrieving an old version Get the whole distribution svn checkout r 3 https://nanohub.org/tools/yourtool/svn/trunk yourtool get revision 3 Get a particular file svn cat r 5 Makefile svn cat r 5 Makefile > Makefile show me revision 5 replace current file with revision 5 Which revision? svn log Makefile svn log show me revisions for this file show me revisions for current directory

Binary files Good defaults. Subversion usually does the right thing: cp diagram.jpg examples svn add examples/diagram.jpg A (bin) examples/diagram.jpg svn commit Adding (bin) examples/diagram.jpg Transmitting file data. Committed revision 8. Recognized as a binary file: no CR/LF translation no merges, only replacements When it fails, set properties yourself: cp demo.dat examples svn add examples/demo.dat A examples/demo.dat svn propset svn:mime-type application/octet-stream examples/demo.dat svn propdel svn:eol-style examples/demo.dat

More Information Web site: http://subversion.apache.org/ Subversion Book From O Reilly & Associates, and also online Quick-start guide for your project: https://nanohub.org/tools/yourtool/wiki/gettingstarted