52
Craft In Development DVCS in practice Jo Voordeckers [email protected] @jovoordeckers blog.pursuit.be Louis Jacomet [email protected] @ljacomet

Distributed Versioning Tools, BeJUG 2010

Embed Size (px)

Citation preview

Craft In Development

DVCS in practice

Jo [email protected]

@jovoordeckersblog.pursuit.be

Louis [email protected]@ljacomet

Craft In Development

Agenda‣ Why revision control

‣ DVCS explained

‣ Workflows and practices

‣ What DVCS bring

‣ DVCS Compared

‣ Tools & plugins

‣ Project hosting

‣ Q & A

Craft In Development

About: Louis Jacomet

‣ 2002 - 2009 - Consultant at Axen

‣ 2009 - Freelance at Craft In Development

‣ Relevant experiences:

‣ Banking 2005 - 2008

‣ Migration of repository from Harvest to SVN => Happy Users!

‣ Administration of SVN, including branching and merging strategies

‣ Tried different ways of structuring workflow with branches, reviews, gates in a team of up to 30 developers where quality was an issue => Unhappy Admin in search of a better world

‣ Git user ( mostly in front of SVN) for about a year

Craft In Development

About: Jo Voordeckers‣ 2002 .. 2005 - Partner at Imagine-IT

‣ 2006 .. 2007 - Senior Software Engineer at Dolmen

‣ 2007 .. 2008 - Technical Project Leader at Dolmen

‣ 2008 - Founded Pursuit Consulting

‣ Java and RIA development contracting & consultancy

‣ iPhone developer: 1 commercial app in the store

‣ User of Mercurial (6 months), SVN (3 years) and CVS (5 years)

‣ Speaker at:

‣ JavaOne, Devoxx, BeJUG, IT Works, SAI

Craft In Development

Craft In Development

Why revision control‣ Tracks history and evolution of software projects

‣ Recover from mistakes

‣ Work on multiple product versions in parallel (prod, features, ...)

‣ (Consistent file set)

‣ Synchronize with collaborators

‣ Backup

‣ Common versioning systems

‣ RCS, CVS, SVN

‣ ClearCase, Perforce, TeamFoundation Server

Craft In Development

http://hginit.com

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

Checking out / Updating

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

Craft In Development

Craft In Development

DVCS Explained

http://atomiq.org/archives/2004/09/things_you_shouldnt_have_to_explain_to_your_kids.html/

Craft In Development

http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development

http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/

Craft In Development

Changesets at the basis

http://hginit.comhttp://petevidler.com/series/mercurial/

Craft In Development

Internally it looks like

http://book.git-scm.com/

Craft In Development

Distributed

http://hginit.com

Feature A Repo

Feature B Repo

Craft In Development

Collaborating: where is my commit?

http://hginit.com

Craft In Development

http://hginit.com

Collaborating: where is my commit?

Craft In Development

http://hginit.com

Collaborating: where is my commit?

Craft In Development

http://hginit.com

Collaborating: where is my commit?

Craft In Development

DVCS Sweet spot‣ A lot faster (10 to 150x)

‣ Very scalable (developers and repo size)

‣ History searching and filtering

‣ Cheap branching, near-instant switching

‣ Effortless merges

‣ Works off-line

‣ As many backups as users (clones) from the central repository

‣ Flexible developer workflow

‣ (Import existing CVS, SVN, … repositories with entire history)

‣ (Metadata is stored in a single .hg or .git folder)

Craft In Development

Effortless merge

merge ?Base

File edited

File moved

Craft In Development

Workflows and practices

‣ Or how you keep your sanity when you are not alone?

Craft In Development

Internal workflows‣ Trunk for development or stable only?

‣ Feature branches

‣ Yes or No?

‣ Short or long lived?

‣ Multiple versions

‣ Tags only or branches and hot fixes standard?

‣ How to make sure a fix is everywhere?

‣ Commits

‣ Anyone anytime or reviews and green light?

Craft In Development

Firm and soft branches

release 1

release 2

Trunk

Feat A

Feat A’

Firm

Soft

Craft In Development

DVCS and workflows

‣ Internal workflows

‣ All supported

‣ Distributed workflows

‣ Personnal workflow

‣ Merge or rebase

Craft In Development

Distributed workflows

Local Local Local

Adapted from http://http://whygitisbetterthanx.com/

Central

Craft In Development

http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/

Craft In Development

http://betterexplained.com/articles/intro-to-distributed-version-control-illustrated/

Craft In Development

Distributed workflows

Dictator Blessed

LieutenantLieutenant

Developer Developer Developer Developer

Adapted from http://http://whygitisbetterthanx.com/

Craft In Development

Personal workflow‣ Your choice

‣ Multiple options available

‣ Allows committing on parallel tasks isolated

‣ Commit is no longer public by default

‣ Choose what goes public

‣ Original workflow

‣ Sanitized workflow

Craft In Development

As before

Hack, Commit, Hack

Fetch

Merge

Push

Hack, Commit, Hack

Hack, Commit, Hack

Craft In Development

Isolated

H.,C.,H.

Mer

ge

Hack, Commit, Hack

Branch

Fetch Fetch

Mergeback H.,C.,H.

Push

Craft In Development

Topic change

H.,C.,H.

Mer

ge

Hack, Commit, Hack

Branch

Fetch

H.,C.,H.

H.,C.,H.

Mer

ge

Branchagain

Push

Craft In Development

Social coder

H.,C.,H.

Hack, Commit, Hack

Branch

Fetch

Offerpatch

Clean up

Reba

se

Fetch

H.,C.,H.

Craft In Development

Merge or rebase?

http://blog.xebia.com/2010/09/20/git-workflow/

Craft In Development

Git vs Hg

Craft In Development

Git vs Hg

Native code (faster) Python + native code

Linux and MacOS supportedmsysgit or Cygwin on Windows

All platforms

easy server on Linux/MacOSserver requires work on Windows

“hg serve” allows serving from any platform easily

GitX on Mac MacHG

IntelliJ, (Eclipse), (Netbeans) Netbeans, Eclipse, IntelliJ 9

Craft In Development

Git vs Hg

Infers rename/copy by history “hg copy”, “hg rename”

Based on similarity of file content “hg addremove -s”, can also infer

Very good SVN integration, incompatible with git sharing

SVN integration

Many commands, strange params Easier to learn, commands match SVN

Terse manpage doc, improved over time

Quality and modern docs

Commits identified by SHA1 only Local human readable ID, global SHA1

Craft In Development

Git vs HgUnlimited parents merge Only 2-way merge

Periodic “git-gc” auto or on demand No maintenance

Private branch namespace + mapping Shared branch namespace

Private user makes public Public history by default

Can destroy history on demand Immutable history,

History usually still accessible except “hg rebase”

Prune to fully delete, explicit

Craft In Development

Git staging area

Craft In Development

Project hosting‣ Mercurial

‣ - http://bitbucket.org/

‣ - http://code.google.com/hosting/

‣ GIT

‣ - http://github.com/

‣ - http://sourceforge.net/ (supports hg too)

Craft In Development

Finding a revision with bisect‣ Binary search for a commit

‣ Can be scripted for a fully automated search

Craft In Development

Git as SVN front-end‣ Fully clone a SVN repository - might take some time

‣ Full clone of a sub project inside the repository supported

‣ Init and fetch only part of history

‣ Take only a specific path (trunk, a branch, ...)

‣ Note: quite hard to fetch later earlier commits

‣ Daily work

‣ rebase to maintain linear history for commits pushed back

‣ Git does not track directories, so it will not send remove dirs to SVN

‣ enabled through --rmdir

Craft In Development

References‣ Mercurial

‣ HG Intro - http://hginit.com/

‣ Small project workflow - http://petevidler.com/series/mercurial/

‣ HG book - http://hgbook.red-bean.com/

‣ GIT

‣ GIT Community book - http://book.git-scm.com/

‣ Pro GIT book - http://progit.org/

‣ Google’s Analysis - http://code.google.com/p/support/wiki/DVCSAnalysis

‣ http://betterexplained.com/articles/a-visual-guide-to-version-control/

Craft In Development