subversion in a distributed world

Download Subversion in a distributed world

If you can't read please download the document

Upload: lorna-mitchell

Post on 16-Apr-2017

10.884 views

Category:

Technology


2 download

TRANSCRIPT

Subversion in a
Distributed World

About Me

Lorna Mitchell

PHP Developer/Trainer/Consultant at Ibuildings

Host of Dutch PHP Conference 2010

Active with PHPWomen.org

Organiser at PHPNW

Personal blog: http://lornajane.net

Twitter: @lornajane

Ibuildings is recruiting!

Source Control

Keeping-place for code

Centralised or distributed

Project archive

Collaboration tool

Integration pointfor development

for business processes

One True Way

its about what works for you:your processyour teamyour environment

The Products

Subversion (svn)

CreatorCollabNet

URLMaintainerApache

UsersPHPSourceforgeFreeBSDApache Software Foundation

LicenseApache/BSD style

DocumentationExcellent, more matureRed Bean Book

subversion has been around longer, since 2000the red bean book is free in digital format, or you can buy an actual book

"Apache Subversion" as of February 2010

Subversion: The Roapmap

Taken from:http://lwn.net/Articles/381794/

Subversion exists to be universally recognized and adopted as an open-source, centralized version control system characterized by its reliability as a safe haven for valuable data; the simplicity of its model and usage; and its ability to support the needs of a wide variety of users and projects, from individuals to large-scale enterprise operations.

Git

CreatorLinus Torvalds

URLMaintainerJunio Hamano

UsersLinux kernelRuby on RailsCakePHPDebianGNOME

LicenseGPL

Documentation"terse", a lot of documentation for an unfamiliar system

http://versioncontrolblog.com/comparison/Bazaar/Git/Mercurial/Subversion/index.html(source of the "terse" quote)uses commands unlike other source control systems'

Bazaar (bzr)

CreatorMartin Pool

URLMaintainerCanonical

UsersUbuntuMySQLInkscapeSquid

LicenseGPL

DocumentationExcellent! Aimed at beginners, UI designed to be intuitive

I had good experiences with their IRC channel

Mercurial (hg)

CreatorMatt Mackall

URLMaintainerMatt Mackall

UsersMozillaOpenOffice.orgSymbianOSNetBeans

LicenseGPL

DocumentationGood, online book and command line help

used by people I want to work for

Features

Atomic commits

File renames

Symbolic links

Pre/Post event hooks

Merge tracking

Tags

EOL conversions

Look out for SVN tags, they're just a copy

Protocols

Everything supports SSH and HTTP(S)

Distributed systems support email

Bazaar supports FTP

Git supports rsync

Centralised vs Distributed Source Control

Centralised Source Control

Centralised Source Control

Traditional model

Subversion uses this

Other products can do it

Distributed Source Control

Distributed Source Control

Distributed Source Control

Git, Bazaar and Mercurial are distributed

Many repositories

Move changes between any or all of these

Revisions vs Changes

From a Joel Spolsky post:

With distributed version control, the distributed part is actually not the most interesting part.

The interesting part is that these systems think in terms of changes, not in terms of versions

Repo Structure: SVN

Top level projects

Branches, tags and trunk

Can check out and commit at subdirectory level

Repo Structure: DVCS

Separate repository per project

Can only check out the whole thing

Controlled at the top level

Can safely copy directories :)

Referring to Revisions

svn: whole repo increments with every change

git: generates a SHA1, a 40 character hexadecimal string

bzr: uses per branch incrementing revision numbers

hg: sequential revision number AND unique changeset ID in a SHA1

CVS: each file had incrementing number

git: which can be abbreviated (tag to make this more readable/useful)

hg: 40 chars of hex which can be abbreviated

Git Hashing

Every commit has an identifying hash

Hash is of commit and includes information about parent

Any change in any version is seen later, because parental hashes change

Ensures consistency

Hashing: Branch 1

commit 69540cd8d2dda61424982d388976c2b3c95d4278Author: Lorna Date: Sat Apr 17 20:56:03 2010 +0100

fixes coding standards compatibility

commit 482fc8d3de1b523c6aa44d0f0a6b97ced9273499Author: Lorna Date: Sat Apr 17 20:51:53 2010 +0100

creating the hello world file

Hashing: Branch 2

commit 24ab6108e42f7662cf32c14e0e707c5534dec47cAuthor: Lorna Date: Sat Apr 17 20:55:14 2010 +0100

extends greeting to universe

commit 67681edee47744780010ecf9e085c0f097a32e11Author: Lorna Date: Sat Apr 17 20:54:36 2010 +0100

formalises world greeting

commit 482fc8d3de1b523c6aa44d0f0a6b97ced9273499Author: Lorna Date: Sat Apr 17 20:51:53 2010 +0100

creating the hello world file

Hashing: Merged Changes

commit baa58ead49d46ac10d360e9d83fd6603c0f57061Author: Lorna Date: Sat Apr 17 20:56:03 2010 +0100

fixes coding standards compatibility

commit 24ab6108e42f7662cf32c14e0e707c5534dec47cAuthor: Lorna Date: Sat Apr 17 20:55:14 2010 +0100

extends greeting to universe

commit 67681edee47744780010ecf9e085c0f097a32e11Author: Lorna Date: Sat Apr 17 20:54:36 2010 +0100

formalises world greeting

commit 482fc8d3de1b523c6aa44d0f0a6b97ced9273499Author: Lorna Date: Sat Apr 17 20:51:53 2010 +0100

creating the hello world file

http://www.flickr.com/photos/bensonkua/2543171151/

Cherry Picking

Cherry Picking Example

$ git fetch originremote: Counting objects: 5, done.remote: Compressing objects: 100% (2/2), done.remote: Total 3 (delta 0), reused 0 (delta 0)Unpacking objects: 100% (3/3), done.From /home/lorna/git_examples2/../git_examples 482fc8d..69540cd master -> origin/master

$ git cherry-pick 69540cd8d2dda61424982d388976c2b3c95d4278

http://www.flickr.com/photos/_heiko/1907664495/

Local is FAST

Local Repo: Advantages

Its FAST

Can see and diff against history while offline

Commit offline, then share these later

Tools

Building Bridges

Bridge between SVN repo and localbzr-svn https://launchpad.net/bzr-svn

git-svn http://www.kernel.org/pub/software/scm/git/docs/git-svn.html

Local distributed-style repo

Communicates with central SVN server

Pulls complete historydiff, log fast and offline

Work offline, commit later

bzr-svn: Setting the Scene

Subversion repository

Standard svn checkout in subversion/

Bzr checkout in /lorna-repo/lorna-trunk

Branch of this in /lorna-repo/lorna-branch

bzr-svn: Adding Content with Bzr

$ bzr commit -m "initialising database files and hello.php"Committing to: /home/lorna/.../lorna-repo/lorna-branch/added dbadded hello.phpadded db/setup.sqlCommitted revision 2.

$ bzr log------------------------------------------------------------revno: 2committer: Lorna Mitchell branch nick: lorna-branchtimestamp: Sun 2010-04-25 14:46:44 +0100message: initialising database files and hello.php------------------------------------------------------------revno: 1svn revno: 578 (on /lorna-test)committer: lornatimestamp: Sun 2010-04-25 12:02:32 +0000message: New project for some source control examples

bzr-svn: Sending Changes to SVN

$ bzr push ../lorna-trunk/All changes applied successfully.Pushed up to revision 2.

$ cd ../../subversion

$ svn log---------------------------------------------------------------------r579 | lorna | 2010-04-25 14:46:23 +0100 (Sun, 25 Apr 2010) | 1 line

initialising database files and hello.php---------------------------------------------------------------------r578 | lorna | 2010-04-25 14:02:32 +0100 (Sun, 25 Apr 2010) | 3 lines

New project for some source control examples

---------------------------------------------------------------------

Changing State of the Landscape

Talk proposed October 2009

Accepted December 2009

Immature tools the deal-breaker

Written March 2010

Tools now usable, and improving

Web Accessible

All these tools are web browseable

Either natively or easily

Trac

Trac now has integration for all these mentioned

Can hook in to update track from commits

Trac provides code browsing and understands source control

http://www.flickr.com/photos/rhk313/2741140421/

Tortoise

Tortoise

TortoiseSVN - widely used windows gui http://tortoisesvn.tigris.org/

TortoiseBzrhttps://launchpad.net/tortoisebzr

TortoiseGithttp://code.google.com/p/tortoisegit/

TortoiseHghttp://tortoisehg.bitbucket.org/

NB Versions not equivalent!

Code Hosting and Collaboration

Provide repository space

Repo browsing, linked projects

Forums and mailing lists

Wiki (or similar: launchpad has blueprints)

Publish downloadable versions

Message other collaborators

Code Hosting Providers

GitHubhttp://github.com/git

Bitbuckethttp://bitbucket.org/hg

Google Codehttp://code.google.com/svn, hg

Launchpadhttps://launchpad.net/bzr

SourceForgehttp://sourceforge.net/svn, bzr, hg, git (and cvs)

also beanstalk, unfuddlecorporations hosting their distributed systems herethat can get very expensive very fast

Making Choices

Distributed Development

Multiple repositories

Distribution is foreign to corporations

Processes are as important as tools

Learning curve

With multiple repositories, the chances of losing data are much smaller. Can work offline

Distribution scares businesses, since they like to control where their code goes

Processes need to support use of more complicated tools

Higher requirements for recruits or more training and support needed for teams

My Development Process

Based on Subversion

Needs process on top of tools to use the best bits in a distributed setup

Single repo

All branches are available and shared

Everything is visible and backed up

Permissions

SVN has very granular access control

Can use any of apache's mechanisms

Can path-restrict read access

Access control for DVCS mostly use hooks

What about access to cloned/forked repositories?

Cost of Transition

Steeper learning curve

Implementation coststool migration

process changes

supporting tool migration

user training (ongoing!)

Hype and dismissive attitudes are unhelpful

A Read-only SVN Copy

Common workaround

Read-only suversion repo

Holds latest changes on a nominated git repo

Tools can hook in

Users can svn:external to it

In My World

Subversion has its placemature

great documentation and ecosystem

simple!

What about managers, junior devs, designers, contractors?

One Recommendation

One Recommendation

One Recommendation

One Recommendation

One Recommendation

Team and Project

Global team of expert geeks - use DCVS (any one)

Colocated team of mixed ability - use SVN

Everything else is a sliding scale!

ConsiderYour people

Your admins

The documentation, support and community of your chosen solution

Choice

(and if you're still interested in git - stay for Travis' talk!)

Thanks!

http://joind.in/1598

[ ]

[ ]

[ ]

image credit