version control with subversion how to set it up, use it, and save your sanity

Download Version control with Subversion how to set it up, use it, and save your sanity

Post on 28-Dec-2015




0 download

Embed Size (px)


  • Version control with Subversionhow to set it up, use it, and save your sanity

  • Introduction

  • My life reduced to bulletsDesigning / developing sites since 1996Independent consultantUsing ColdFusion since version 5Using Fusebox since version 2Using XHTML/CSS since 2003Using Subversion off/on October 2006More off than on

  • Version control in a nutshellCentral Repository of all code and changes made to it by anyone over timeDevelopers get the latest copy, edit, and check it back in to the repositoryChanges made to the same file by different developers are mergedIf need be, you can go back to a previous version of the code

  • Why version control at all?A Time Machine for codeAccounts for all changesMakes multi-version management easierThe ultimate CYA tool

  • Source control vs. version controlSource Code ManagementMore of a total solution that includes things like bug tracking, WikiVersion Control / Revision ControlThis is what Subversion does

  • Not just for code, by the wayDesign compsProject documentationRecipesDrafts of memos, letters, novelsAnything you want to revise over time

  • Not just for teams, by the wayI use it for my own stuffRevert to the previous version if I screw upNot that I screw upYep.What, what are you looking at?

  • Version Control ConceptsThe steps of version control

  • Version Control StepsCreate a repository of project files (code)CHECKOUT a working copy of the code to working directoryEdit code

  • Version Control StepsCOMMIT your changes back into the repositoryIf someone else changed the same file as you, resolve differences to the changed files as needed (MERGE)UPDATE your working copy before continuing work the next time

  • Version control models

  • File sharing: the problem to avoid

  • Lock-Modify-Unlock

  • Copy-Modify-Merge

  • Copy-Modify-Merge (contd)

  • OptionsA quick look at what else is out there

  • Microsoft Visual Source SafeMicrosoft doesnt use thisCan cause files to become lost, corruptedSlow, not designed to work over internet$500/developer (?)

  • Concurrent Versioning System (CVS)Released in 1986Free, open sourceRelatively easy to useDesigned for a team environment

  • CVS LimitationsCannot move/rename files in CVSDirectory move/changes arent versionedPoor unicode supportDoesnt support non-ASCII characters wellNo versioning of symbolic linksBinary files are saved in their entirety

  • Other commercial VCSsPerforceFree for up to 2 users; OSS$800 per developer seatSourceHaven$295/developer seat

  • Subversion

  • About SubversionDesigned to replace CVSBegan in 2000Self-hosting in 20011.0 in Feb 2004Current version: 1.4.5

  • Subversion benefitsDirectory versioningFilename versioningAtomic commits all succeed or all failMetadata keywords/commentNetworking support

  • Subversion benefits (contd)Delta compressionSaves differences between files (even binary)Branching / TaggingWell-defined API (e.g., Trac, TortoiseSVN, SCPlugin)Free!

  • InstallationSetting it up

  • Access options

  • SVNServe DaemonEasy, quick install1-click setup (ok, it takes more than 1 click)All projects under one repositoryYou can create sub projects under this main repository, but its less elegant than separate repositoriesListens on nonstandard port (3690)Across internet, there could be a firewall issue

  • SVNServe Daemon / 1-click setupIdeal if you want to get up and running quick to play with SubversionNot ideal if you want to version more than one project and/or work across a network

  • Apache, WebDAV/DeltaVAllows you to work with an SVN repository anywhere in the worldUses http:// or https:// on port 80 no firewall issues!Use authentication to restrict to username/password holders

  • Subversion Repository

  • My Repository

  • Physical repository

  • Virtual repository

  • Revision history

  • One repository, multiple projectsindex.cfmdsp_header.cfmdsp_footer.cfmindex.cfmdsp_header.cfmdsp_footer.cfm

  • One repository for each projectindex.cfmdsp_header.cfmdsp_footer.cfmindex.cfmdsp_header.cfmdsp_footer.cfm

  • Interacting with SubversionSome approaches

  • Command line interfaceGeneral client command linesvn [command ] [arguments ]Read or update your working copysvn checkoutsvn updateMake changessvn addsvn deletesvn copysvn moveCommit your changessvn commit

  • TortoiseSVN client

  • SCPlugin client

  • Subclipse

  • Using SubversionSimple steps to save your sanity

  • Using SubversionCreate the repositoryImport files into repositoryCheckout files as a working copyChange, commit, updateResolve conflicts (if needed)

  • Using SubversionDemo

  • Branching

  • Branching notesBranches are for the minorityUse for trying out new features, etc.You may branch from trunk or from branchBut dont unless you really need toCan merge changes from the branch to trunk or vice-versaDont be scared!

  • Using Subversion and CFOld WayWe all update files on a dev serverNew WayCheck out code to a local working directoryDevelop locallyCommit changes backDeploy build from SVN to dev server

  • Tips and Best PracticesUse version controlDont break the treeDont commit broken code or code that is not finishedDont lock files unless you have a durned good reason toExplain commits completely and in plain language (use diff!)

  • Tips and Best Practices (contd)Update early and oftenCommit early and oftenwithout breaking buildWhen in doubt, resolve conflicts with fellow team membersVersion the stuff you control, not the stuff your code producesUse one repository per projectSubversion != Backup

  • Thank You!chris@christianready.comhttp://christianready.com410-382-8070

  • Copyright InfoAll Diagrams from Version Control with Subversion available from Copyright (c) 2002-2004 Ben Collins-Sussman, Brian W. Fitzpatrick, C. Michael Pilato. This work is licensed under the Creative Commons Attribution License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305,USA.

  • Resources

  • SitesSVN Project Forum

  • UtilitiesSVN 1-click setup SVN Dude

  • BooksVersion Control with Subversion Version Control with Subversion

  • Articles on version control/branchingSubversion for Windows & Apache up a Subversion Server under Windows branching quick start Control HOWTO