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

Distributed Versioning Tools, BeJUG 2010

Feb 20, 2017

Download

Technology

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Distributed Versioning Tools, BeJUG 2010

Craft In Development

DVCS in practice

Jo [email protected]

@jovoordeckersblog.pursuit.be

Louis [email protected]@ljacomet

Page 2: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Agenda‣ Why revision control

‣ DVCS explained

‣ Workflows and practices

‣ What DVCS bring

‣ DVCS Compared

‣ Tools & plugins

‣ Project hosting

‣ Q & A

Page 3: Distributed Versioning Tools, BeJUG 2010

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

Page 4: Distributed Versioning Tools, BeJUG 2010

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

Page 5: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Page 6: Distributed Versioning Tools, BeJUG 2010

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

Page 7: Distributed Versioning Tools, BeJUG 2010

Craft In Development

http://hginit.com

Page 8: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 9: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Checking out / Updating

Page 10: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 11: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 12: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 13: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 14: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 15: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Page 16: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Page 17: Distributed Versioning Tools, BeJUG 2010

Craft In Development

DVCS Explained

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

Page 18: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 19: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 20: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Changesets at the basis

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

Page 21: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Internally it looks like

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

Page 22: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Distributed

http://hginit.com

Feature A Repo

Feature B Repo

Page 23: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Collaborating: where is my commit?

http://hginit.com

Page 24: Distributed Versioning Tools, BeJUG 2010

Craft In Development

http://hginit.com

Collaborating: where is my commit?

Page 25: Distributed Versioning Tools, BeJUG 2010

Craft In Development

http://hginit.com

Collaborating: where is my commit?

Page 26: Distributed Versioning Tools, BeJUG 2010

Craft In Development

http://hginit.com

Collaborating: where is my commit?

Page 27: Distributed Versioning Tools, BeJUG 2010

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)

Page 28: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Effortless merge

merge ?Base

File edited

File moved

Page 29: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Workflows and practices

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

Page 30: Distributed Versioning Tools, BeJUG 2010

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?

Page 31: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Firm and soft branches

release 1

release 2

Trunk

Feat A

Feat A’

Firm

Soft

Page 32: Distributed Versioning Tools, BeJUG 2010

Craft In Development

DVCS and workflows

‣ Internal workflows

‣ All supported

‣ Distributed workflows

‣ Personnal workflow

‣ Merge or rebase

Page 33: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Distributed workflows

Local Local Local

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

Central

Page 34: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 35: Distributed Versioning Tools, BeJUG 2010

Craft In Development

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

Page 36: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Distributed workflows

Dictator Blessed

LieutenantLieutenant

Developer Developer Developer Developer

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

Page 37: Distributed Versioning Tools, BeJUG 2010

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

Page 38: Distributed Versioning Tools, BeJUG 2010

Craft In Development

As before

Hack, Commit, Hack

Fetch

Merge

Push

Hack, Commit, Hack

Hack, Commit, Hack

Page 39: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Isolated

H.,C.,H.

Mer

ge

Hack, Commit, Hack

Branch

Fetch Fetch

Mergeback H.,C.,H.

Push

Page 40: Distributed Versioning Tools, BeJUG 2010

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

Page 41: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Social coder

H.,C.,H.

Hack, Commit, Hack

Branch

Fetch

Offerpatch

Clean up

Reba

se

Fetch

H.,C.,H.

Page 42: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Merge or rebase?

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

Page 43: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Git vs Hg

Page 44: Distributed Versioning Tools, BeJUG 2010

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

Page 45: Distributed Versioning Tools, BeJUG 2010

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

Page 46: Distributed Versioning Tools, BeJUG 2010

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

Page 47: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Git staging area

Page 48: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Project hosting‣ Mercurial

‣ - http://bitbucket.org/

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

‣ GIT

‣ - http://github.com/

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

Page 49: Distributed Versioning Tools, BeJUG 2010

Craft In Development

Finding a revision with bisect‣ Binary search for a commit

‣ Can be scripted for a fully automated search

Page 50: Distributed Versioning Tools, BeJUG 2010

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

Page 51: Distributed Versioning Tools, BeJUG 2010

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/

Page 52: Distributed Versioning Tools, BeJUG 2010

Craft In Development