Download It

33
1 www.cfunited.com SUBVERSION FOR SMARTIES SUBVERSION FOR SMARTIES Cameron Childress [email protected]

Transcript of Download It

Page 1: Download It

1www.cfunited.com

SUBVERSION FOR SMARTIESSUBVERSION FOR SMARTIESSUBVERSION FOR SMARTIESSUBVERSION FOR SMARTIES

Cameron Childress

[email protected]

Page 2: Download It

2www.cfunited.com

IntroIntroIntroIntro

• ColdFusion, since 1996

• ACFUG since, 1998

• Foosball, since 2001

• Sumo Consulting, since 2002

Page 3: Download It

3www.cfunited.com

Session DescriptionSession DescriptionSession DescriptionSession Description

So you know how to Branch and Tag, but you have a sneaky suspicion there is more you could be doing with SVN. Come find out what you've been missing out on and how to make Subversion do more for you!

Page 4: Download It

4www.cfunited.com

PreviewPreviewPreviewPreview

• Review of SVN basics

• A few non-SVN things

• Interesting bits built into SVN

• External tools

• Some examples

Page 5: Download It

5www.cfunited.com

Review: Key Advantages vs. VSS or CVSReview: Key Advantages vs. VSS or CVSReview: Key Advantages vs. VSS or CVSReview: Key Advantages vs. VSS or CVS

• SVN Server runs on many platforms• Many clients available for SVN• SVN is free & open source• Too many more to list…

Page 6: Download It

6www.cfunited.com

•Subversion vs. Git – BasicsSubversion vs. Git – Basics•Subversion vs. Git – BasicsSubversion vs. Git – Basics

• Created by Linus Torvalds

• Replaced BitKeeper

• Used for Linux Kernel, PERL, RoR, Android OS

• Download at:http://git-scm.com

Page 7: Download It

7www.cfunited.com

Subversion vs. Git – Git WinsSubversion vs. Git – Git WinsSubversion vs. Git – Git WinsSubversion vs. Git – Git Wins

• SVN is Centralized, Git is distributed• Local operations are faster• Branching Handling• Merge Handling• Smaller HD Footprint

(Mozilla 12 GiB in SVN, 420 MiB in Git)

Page 8: Download It

8www.cfunited.com

Subversion vs Git – SVN WinsSubversion vs Git – SVN WinsSubversion vs Git – SVN WinsSubversion vs Git – SVN Wins

• Better IDE support• SVN has a de-facto single Repository• Centralized access control• Version numbers are easier in SVN

• Git / SVN Comparisonhttp://git.or.cz/gitwiki/GitSvnComparsion

Page 9: Download It

9www.cfunited.com

Review: Subversion BasicsReview: Subversion BasicsReview: Subversion BasicsReview: Subversion Basics

• Conventional Project Structure• Branches• Tags• Trunk

• Typical Exposure:• Comit• Update• Resolve Conflicts• Branch / Merge (maybe)

Page 10: Download It

10www.cfunited.com

Review: Key Subversion FeaturesReview: Key Subversion FeaturesReview: Key Subversion FeaturesReview: Key Subversion Features

• Revision numbers apply to entire tree• Directories are versioned• Working Copy vs. Repository• Caches pristine copy which allows

• Revert• Diff• Status

• Branches and tags are normal directories• Binary files are stored as difference data

Page 11: Download It

11www.cfunited.com

Something New in SVN: ChangelistsSomething New in SVN: ChangelistsSomething New in SVN: ChangelistsSomething New in SVN: Changelists

• Introduced in SVN 1.5 (currently at 1.6)• Also a feature in Perforce• Groups files for operations:

• Commit• Diff

• Great for grouping files for bug resolution

Page 12: Download It

12www.cfunited.com

Changelists – You Should KnowChangelists – You Should KnowChangelists – You Should KnowChangelists – You Should Know

• Part of working copy, not repository• Only works with files, not directories• One changelist assignment per file• Changelists cleared on commit

• Override using flag “--keep-changelists”

Page 13: Download It

13www.cfunited.com

Changelist: How To – Command LineChangelist: How To – Command LineChangelist: How To – Command LineChangelist: How To – Command Line

• Syntax: svn changelist [listname] [filelist]

• Listname can be any string• Filelist supports wildcards

• More:http://svnbook.red-bean.com/nightly/en/svn.advanced.changelists.html

Page 14: Download It

14www.cfunited.com

Changelist: How To – TortoiseChangelist: How To – TortoiseChangelist: How To – TortoiseChangelist: How To – Tortoise

• Example…

Page 15: Download It

15www.cfunited.com

By the way: Perforce Also Has…By the way: Perforce Also Has…By the way: Perforce Also Has…By the way: Perforce Also Has…

• Labels• Similar to Tags, but not simply convention

• ClientSpecs• Maps repo / directories

• Together…• Very powerful for deployment• Great for large teams w/distributed roles

Page 16: Download It

16www.cfunited.com

SVN PropertiesSVN PropertiesSVN PropertiesSVN Properties

• Think “metadata” for each file• Stored in .svn/props• Checked into repo with file• Versioned• Special Properties

• svn:ignore• svn:keywords• svn:needs-lock• svn:executable

Page 17: Download It

17www.cfunited.com

Special SVN Property: svn:keywordsSpecial SVN Property: svn:keywordsSpecial SVN Property: svn:keywordsSpecial SVN Property: svn:keywords

• Used for keyword substitution• Must be explicitly turned on• svn:keywords

Date Revision Author HeadURL Id

• Example…

Page 18: Download It

18www.cfunited.com

Automate Keyword SubstitutionAutomate Keyword SubstitutionAutomate Keyword SubstitutionAutomate Keyword Substitution

• Config file “miscellany” section• Applies to working copy, not repo• On windows, found in :

/%AppData%/Subversion

More:

http://svnbook.red-bean.com/nightly/en/

svn.advanced.props.special.keywords.html

Page 19: Download It

19www.cfunited.com

HooksHooksHooksHooks

• Run a program at certain points in commit process

• Implemented as bat file in Windows• Live in repo, not working copy• Examples by default found in “repo/hooks”

http://svnbook.red-bean.com/nightly/en/

svn.reposadmin.create.html#svn.reposadmin.create.hooks

Page 20: Download It

20www.cfunited.com

Hook TypesHook TypesHook TypesHook Types

• start-commit• pre-commit / post-commit• pre-revprop-change / post-revprop-change• pre-lock / post-lock• pre-unlock / post-unlock

Page 21: Download It

21www.cfunited.com

Hooks: TipsHooks: TipsHooks: TipsHooks: Tips

• Hook programs execute with an empty environment

• Do not modify a commit transaction using hook scripts

• Permissions, permissions, permissions

Page 22: Download It

22www.cfunited.com

Hooks: IdeasHooks: IdeasHooks: IdeasHooks: Ideas

• Push code to staging server• Send notification emails to dev team• Update issue / project management software

Page 23: Download It

23www.cfunited.com

Resources for HooksResources for HooksResources for HooksResources for Hooks

• Brad Wood’s Bloghttp://www.codersrevolution.com/index.cfm/2008/9/15/Creating-a-postcommit-hook-for-Subversion

• Dan Switzer’s Bloghttp://blog.pengoworks.com/index.cfm/

2008/2/5/Debugging-Subversion-Repository-Hooks-in-Windows

Page 24: Download It

24www.cfunited.com

Visual SVN ServerVisual SVN ServerVisual SVN ServerVisual SVN Server

• Windows installer (visualsvn.com)• Installs Apache based Service• HTTPS/SSL Capable• Internally @ SVN 1.6.4 (current) as of 8/12/09

• Take a Look…

Page 25: Download It

25www.cfunited.com

SVN Abstration LayerSVN Abstration LayerSVN Abstration LayerSVN Abstration Layer

• Provides abstraction for RIA ForgeBy: Rob Gonda

• Configure via XML• Uses Apache by default, partial support for

SVNServe

• http://svnservice.riaforge.org/

Page 26: Download It

26www.cfunited.com

SVN Abstraction LayerSVN Abstraction LayerSVN Abstraction LayerSVN Abstraction Layer

• Repositories Create, delete, list

• Users Create, delete, list, changepassword

• History List

Page 27: Download It

27www.cfunited.com

SVN Abstraction Layer: Example CodeSVN Abstraction Layer: Example CodeSVN Abstraction Layer: Example CodeSVN Abstraction Layer: Example Code

svnService = createObject('component', 'models.svnService').init('config/config.xml');

svnService.listRepos();

svnService.create(‘myRepo);

svnService.getLog(‘myRepo', 10);

svnService.addUser(‘myRepo', ‘username', ‘password');

Page 28: Download It

28www.cfunited.com

SVN SyncSVN SyncSVN SyncSVN Sync

• SVNSync – Repo BrowserBy: Tom de Manincor

• Configure via XML (X2)• config/environment.xml• model/svnAPI/config.xml

• http://svnsync.riaforge.org/

Page 29: Download It

29www.cfunited.com

SVN SyncSVN SyncSVN SyncSVN Sync

• Let’s check it out…

Page 30: Download It

30www.cfunited.com

Roundup: RIA Forge ProjectsRoundup: RIA Forge ProjectsRoundup: RIA Forge ProjectsRoundup: RIA Forge Projects

• Deployment builder - ANT/SVNBy: Matt Rileyhttp://deploymentbuilder.riaforge.org/

• Skweegee - TRAC + more(formerly Trac_Fu)By: Russ Johnsonhttp://skweegee.riaforge.org/

Page 31: Download It

31www.cfunited.com

Roundup: RIA Forge ProjectsRoundup: RIA Forge ProjectsRoundup: RIA Forge ProjectsRoundup: RIA Forge Projects

• SVNAuthz.cfc – Manipulate authz filesBy: Terrance Ryanhttp://svnauthz.riaforge.org/

• SVNUtil – AIR App, Removes .svn infoBy: Omar Gonzalezhttp://svnutil.riaforge.org/

Page 32: Download It

32www.cfunited.com

ResourcesResourcesResourcesResources

• Book - Version Control with Subversionhttp://svnbook.red-bean.com

• Windows Installer / Admin - VisualSVNhttp://www.visualsvn.com

Page 33: Download It

33www.cfunited.com

Questions?Questions?Questions?Questions?

• Contact:• [email protected]• cameroncf (YIM / AIM)

• Presentation available NOW via:• USB Thumbdrive

http://www.sumoc.com/downloads/files/svn.zip

• Take the Survey:http://tinyurl.com/cfunitedsurvey