+ All Categories
Home > Technology > Svn Best Practices

Svn Best Practices

Date post: 17-May-2015
Category:
Upload: derek-gallo
View: 12,816 times
Download: 0 times
Share this document with a friend
Description:
High level view of some best practices to follow that many people starting to us SVN don't realize.
Popular Tags:
16
SVN Best Practices Derek Gallo - NFi Studios 1 Friday, November 7, 2008
Transcript
Page 1: Svn Best Practices

SVN Best PracticesDerek Gallo - NFi Studios

1Friday, November 7, 2008

Page 2: Svn Best Practices

Introduction

• What is version control?

• Why use it?

• Revisions/Backup

• Logs

• Version/Release Management

• COLLABORATION

2Friday, November 7, 2008

Page 3: Svn Best Practices

Basics

• Repository

• Checkout

• Commit

• Update

• Merge

3Friday, November 7, 2008

Page 4: Svn Best Practices

Basic Rules of Thumb

• Comment, Comment, Comment

• Update and TEST before Commit

• Work from your own local copy

• Commit small autonomous changes

• Validate the files you are committing, you actually changed

• Watch for Conflicts

4Friday, November 7, 2008

Page 5: Svn Best Practices

SVN Clients

• Windows = TortoiseSVN

• *NIX = command line

• IDE Integration

• There is no complete replacement for the command line. Learn how to use it.

5Friday, November 7, 2008

Page 6: Svn Best Practices

Starting a Project

• Create the project folder structure

• Trunk

• Main development location

• Branches

• For temporary isolation or codebase splits.

• Tags

• Snapshots of code at a given point in time

6Friday, November 7, 2008

Page 7: Svn Best Practices

Repository Layout• Single Project - One project per repository location.

• Pros

• Isolated revision numbers

• Isolated codebase

• Isolated security model

• Cons

• Isolated codebase

• Multiple Urls to remember

• Multiple locations to maintain

7Friday, November 7, 2008

Page 8: Svn Best Practices

Repository Layout

• Multi-Project Layout - Several projects in one repository

• Pros

• Easy to merge code between projects

• Single url for all projects

• One repository to maintain

• Cons

• Revision numbers span across all projects

• Harder to isolate users to appropriate repositories

8Friday, November 7, 2008

Page 9: Svn Best Practices

Use SVN Properties• Link external libraries via svn externals

• Easier to update libraries or change versions.

• Helps enforce library separation

• More granular security model

• Use svn ignore appropriately

• configurations files

• os dependent files

• IDE project files

• User generated data

• Temporary folders & logs

9Friday, November 7, 2008

Page 10: Svn Best Practices

Use Migrations

• They are not just for Rails

• Allows you to easily version your DB schema

• Doctrine for PHP supports migrations

• Be careful about migration numbers when committing

10Friday, November 7, 2008

Page 11: Svn Best Practices

Branching/Tagging

• SVN and your development process/release cycle go hand in hand.

• Tag the completion of every milestone/sprint

• Create a tag for every version number

• Create a tag for the latest production release

• NEVER modify tags!

11Friday, November 7, 2008

Page 12: Svn Best Practices

Branching/Tagging

• Create Branches to isolate experimental work.

• Create a Branch for every phase of your release cycle (QA, Staging, Beta, etc.)

• Make necessary fixes/changes in branch and “merge down” to trunk

• Keep branches for every released version

• “Freeze” externals when moving to release branches

12Friday, November 7, 2008

Page 13: Svn Best Practices

Administration

• Apache mod_svn vs. svnserve

• Use SSL

• Use mod_authz

• Regular dumps to backup

13Friday, November 7, 2008

Page 14: Svn Best Practices

Integrate w/ Project Management

• Use software with SVN Browser

• Trac

• Unfuddle

• Log revision number in ticket updates

• Log ticket number in commit logs

14Friday, November 7, 2008

Page 15: Svn Best Practices

Automation

• SVN Api and Hooks

• Policy enforcement using pre-commit

• Email notifications using post-commit

• Automate changelogs

• Track code-reviews using properties

• Automate Unit Tests at pre-commit

15Friday, November 7, 2008

Page 16: Svn Best Practices

Additional Reading

• Version Control With Subversion

• O'Reilly Media.

• http://svnbook.red-bean.com/

• Subversion Version Control

• by William Nagel

• Prentice Hall

16Friday, November 7, 2008


Recommended