Presentation is loading. Please wait.

Presentation is loading. Please wait.

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

Similar presentations


Presentation on theme: "Version control with Subversion how to set it up, use it, and save your sanity."— Presentation transcript:

1

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

3 Introduction

4 My life reduced to bullets Designing / developing sites since 1996 Independent consultant Using ColdFusion since version 5 Using Fusebox since version 2 Using XHTML/CSS since 2003 Using Subversion off/on October 2006 –More off than on…

5 Version control in a nutshell Central Repository of all code and changes made to it by anyone over time Developers get the latest copy, edit, and “check it back in” to the repository Changes made to the same file by different developers are merged If need be, you can go back to a previous version of the code

6 Why version control at all? A “Time Machine” for code Accounts for all changes Makes multi-version management easier The ultimate “CYA” tool

7 Source control vs. version control Source Code Management –More of a “total solution” that includes things like bug tracking, Wiki Version Control / Revision Control –This is what Subversion does

8 Not just for code, by the way… Design comps Project documentation Recipes Drafts of memos, letters, novels Anything you want to revise over time

9 Not just for teams, by the way I use it for my own stuff Revert to the previous version if I screw up Not that I screw up Yep. What, what are you looking at?

10 Version Control Concepts The “steps” of version control

11 Version Control Steps Create a repository of project files (code) CHECKOUT a working copy of the code to working directory Edit code

12 Version Control Steps COMMIT your changes back into the repository If 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

13 Version control models

14 File sharing: the problem to avoid

15 Lock-Modify-Unlock

16 Copy-Modify-Merge

17 Copy-Modify-Merge (cont’d)

18 Options A quick look at what else is out there…

19 Microsoft Visual Source Safe Microsoft doesn’t use this Can cause files to become lost, corrupted Slow, not designed to work over internet $500/developer (?)

20 Concurrent Versioning System (CVS) Released in 1986 Free, open source Relatively easy to use Designed for a team environment

21 CVS Limitations Cannot move/rename files in CVS Directory move/changes aren’t versioned Poor unicode support –Doesn’t support non-ASCII characters well No versioning of symbolic links Binary files are saved in their entirety

22 Other commercial VCS’s Perforce –Free for up to 2 users; OSS –$800 per developer seat SourceHaven –$295/developer seat

23 Subversion

24 About Subversion Designed to replace CVS Began in 2000 Self-hosting in 2001 1.0 in Feb 2004 Current version: 1.4.5

25 Subversion benefits Directory versioning Filename versioning Atomic commits – all succeed or all fail Metadata – keywords/comment Networking support

26 Subversion benefits (cont’d) Delta compression –Saves differences between files (even binary) Branching / Tagging Well-defined API (e.g., Trac, TortoiseSVN, SCPlugin) Free!

27 Installation Setting it up…

28 Access options

29 SVNServe Daemon Easy, quick install –1-click setup (ok, it takes more than 1 click) All projects under one repository –You can create sub projects under this main repository, but it’s less elegant than separate repositories Listens on nonstandard port (3690) –Across internet, there could be a firewall issue

30 SVNServe Daemon / 1-click setup Ideal if you want to get up and running quick to play with Subversion Not ideal if you want to version more than one project and/or work across a network

31 Apache, WebDAV/DeltaV Allows you to work with an SVN repository anywhere in the world Uses http:// or https:// on port 80 – no firewall issues! Use authentication to restrict to username/password holders

32 Subversion Repository

33 My Repository

34 Physical repository

35 Virtual repository

36 Revision history

37 One repository, multiple projects index.cfm dsp_header.cfm dsp_footer.cfm index.cfm dsp_header.cfm dsp_footer.cfm

38 One repository for each project index.cfm dsp_header.cfm dsp_footer.cfm index.cfm dsp_header.cfm dsp_footer.cfm

39 Interacting with Subversion Some approaches…

40 Command line interface General client command line svn [command ] [arguments ] Read or update your working copy svn checkout svn update Make changes svn add svn delete svn copy svn move Commit your changes svn commit

41 TortoiseSVN client

42 SCPlugin client

43 Subclipse

44 Using Subversion Simple steps to save your sanity

45 Using Subversion Create the repository Import files into repository Checkout files as a working copy Change, commit, update Resolve conflicts (if needed)

46 Using Subversion Demo

47 Branching

48 Branching notes Branches are for the minority –Use for trying out new features, etc. You may branch from trunk or from branch –But don’t unless you really need to Can merge changes from the branch to trunk or vice-versa Don’t be scared!

49 Using Subversion and CF Old Way –We all update files on a “dev server” New Way –Check out code to a local working directory –Develop locally –Commit changes back –Deploy “build” from SVN to dev server

50 Tips and Best Practices Use version control Don’t break the tree –Don’t commit broken code or code that is not finished Don’t lock files unless you have a durned good reason to Explain commits completely and in plain language (use diff!)

51 Tips and Best Practices (cont’d) Update early and often Commit early and often –without breaking build When in doubt, resolve conflicts with fellow team members Version the stuff you control, not the stuff your code produces Use one repository per project Subversion != Backup

52 Thank You! chris@christianready.com http://christianready.com 410-382-8070

53 Copyright Info All Diagrams from Version Control with Subversion available from http://svnbook.red-bean.comhttp://svnbook.red-bean.com 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 http://creativecommons.org/licenses/by/2.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305,USA. http://creativecommons.org/licenses/by/2.0/

54 Resources

55 Sites SVN Project –http://subversion.tigris.org/http://subversion.tigris.org/ SVN Forum –http://www.svnforum.org/http://www.svnforum.org/

56 Utilities SVN 1-click setup –http://svn1clicksetup.tigris.org/http://svn1clicksetup.tigris.org/ Tortoise SVN –http://tortoisesvn.tigris.org/http://tortoisesvn.tigris.org/ Subclipse –http://subclipse.tigris.org/http://subclipse.tigris.org/ CVS Dude –http://cvsdude.com/http://cvsdude.com/

57 Books Version Control with Subversion –http://svnbook.red-bean.com/http://svnbook.red-bean.com/ Pragmatic Version Control with Subversion –http://pragmaticprogrammer.com/titles/svn/http://pragmaticprogrammer.com/titles/svn/

58 Articles on version control/branching Subversion for Windows & Apache –http://svn.spears.at/http://svn.spears.at/ Setting up a Subversion Server under Windows –http://blogs.vertigosoftware.com/teamsystem/archive/2006/01/16 /Setting_up_a_Subversion_Server_under_Windows.aspxhttp://blogs.vertigosoftware.com/teamsystem/archive/2006/01/16 /Setting_up_a_Subversion_Server_under_Windows.aspx Subversion branching quick start –http://www.nedbatchelder.com/text/quicksvnbranch.htmlhttp://www.nedbatchelder.com/text/quicksvnbranch.html http://www.cmcrossroads.com/bradapp/acme/branching/ Source Control HOWTO –http://www.ericsink.com/scm/source_control.htmlhttp://www.ericsink.com/scm/source_control.html


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

Similar presentations


Ads by Google