Revision Control

Software Engineering SS 2007 Agenda

Revision Control 1. Motivation 2. Overview 3. Tools 4. First Steps 5. Links

Objectives - Use revision control system for collaboration

Software Engineering, lecture #: Topic 2 Revision Control

1. Motivation 2. Overview 3. Tools 4. First Steps 5. Links

Software Engineering, lecture #: Topic 3 Motivation

Usually several developers work on code Common problems:

¾Who owns master version

¾How to collect current version

¾How to keep code changes consistent

¾How to roll back bad code changes

¾Which file versions form Release Candidate 3

Software Engineering, lecture #: Topic 4 Revision Control

Main purpose Coordinate work from different contributors

Other benefits Track changes Access older versions Name specific set of versions Split work into different versions

Software Engineering, lecture #: Topic 5 Revision Control

1. Motivation 2. Overview 3. Tools 4. First Steps 5. Links

Software Engineering, lecture #: Topic 6 Different flavours

File locking Only one user can modify a file at any time No conflicts, but dead-locks between contributors Example: ClearCase

Version merging All users can modify all files simultaneously Conflicts need to be resolved (merging) Examples: CVS, subversion

Software Engineering, lecture #: Topic 7 File locations

Repository Directory or data base on server Contains all file versions and information on versions Never manipulated manually Working copy Copy of (part of) repository on local disk Used to change and add files

Software Engineering, lecture #: Topic 8 Important operations

Check-Out Copy all files from repository to local disk Commit (Check-In) Copy changes in working copy to repository Update Copy changes in repository to working copy Merge Resolve conflicts between working copy and repository Tag Name a revision (set of files with versions)

Software Engineering, lecture #: Topic 9 Branch & Merge

Branch Split off new version Used for maintenance releases (bugfix) HEAD: main version Merge Add changes from one branch to another Tag branches after merging!

Software Engineering, lecture #: Topic 10 Revision Control

1. Motivation 2. Overview 3. Tools 4. First Steps 5. Links

Software Engineering, lecture #: Topic 11 CVS: Concurrent Versions System

Repository in file system

Requirements CVS client installed Write access on server (via shell or NFS)

Front-ends CrossVC: Windows, Linux, Mac TortoiseCVS: plug-in for Windows explorer Eclipse: IDE with built-in CVS

Software Engineering, lecture #: Topic 12 Subversion

Repository in data base “Next version” of CVS

Requirements subversion client installed subversion server (standalone or Apache module)

Front-ends CrossVC: Windows, Linux, Mac TortoiseSVN: plug-in for Windows explorer Subclipse: plug-in for Eclipse

Software Engineering, lecture #: Topic 13 Revision Control

1. Motivation 2. Overview 3. Tools 4. First Steps 5. Links

Software Engineering, lecture #: Topic 14 CVS/SVN: First Steps

Create directory on server for repository CVS: cvs -d /home/me/cvs init SVN: open https://svn.vis.ethz.ch/, follow instructions

Create local directory with initial files

Move initial files to repository “Make new module” (TortoiseCVS) “Import” (CrossVC, TortoiseSVN)

CVS/SVN demo with Tortoise and/or CrossVC

Software Engineering, lecture #: Topic 15 Good Practice

Keep code in repository consistent! When feature implemented / bug fixed: Update Compile Run automated module tests Fix bugs Iterate until no bugs found Commit

Software Engineering, lecture #: Topic 16 Combining Tools

Use build tool to

compile

run automated tests

Always provide Bug Report ID in commit comment

register requirements as issues/bugs

Software Engineering, lecture #: Topic 17 Revision Control

1. Motivation 2. Overview 3. Tools 4. First Steps 5. Links

Software Engineering, lecture #: Topic 18 Links

CrossVC http://www.crossvc.com/ TortoiseCVS, TortoiseSVN http://www.tortoisecvs.org/ http://tortoisesvn.net/ Eclipse http://www.eclipse.org/ http://subclipse.tigris.org/

Software Engineering, lecture #: Topic 19 Repositories

CVS

directory on nethz account

accessible via samba (:local:) or secure shell (:ext:)

Subversion

Subversion server provided by VIS

https://svn.vis.ethz.ch

Software Engineering, lecture #: Topic 20