16
Mercurial robert maclean www.sadev.co.za ∞ @rmaclean ∞ [email protected]

Mercurial

Embed Size (px)

DESCRIPTION

Mercurial is part of a modern way of thinking about source control where the system is distributed among developers compared to the client server model of things like SubVersion. This presentation covers what that means to developers.

Citation preview

Page 1: Mercurial

Mercurial

robert macleanwww.sadev.co.za ∞ @rmaclean ∞

[email protected]

Page 2: Mercurial

Mercurial

• April 2005• Created for Linux Kernel • DVCS– Distributed Version Control System

• It’s just source control, so what you know is still relevant

Page 3: Mercurial

Client/Server Source Control

SVN

All code, all history, all

settings

Just working set

Merge has only working set knowledge

Connection to server needed

Cannot share between people

without the server

Server is unaware of renaming

.svn pollution

Good & established tool

(build, WI) integration

LOCKS?! ARRGGHH!

Central management

Page 4: Mercurial

DVCS

hg

hg

hg

hg

hg

hg

Everyone has full repo

Merge has full

knowledge

Can work disconnecte

d

Aware of renaming

Easy to share between people

Single .hg directory

No locking

Tool integration is still growing

Page 5: Mercurial

So it is perfect?

• Some management (users) issues– Can be solved on the transport

• Maturity needed– No reason not to check-in ALL the time– Backups?– Can’t delete branches

• Performance issues– Can’t pull a working set

• Workflows need to change

Page 6: Mercurial

Workflow chaos

hg

hg

hg

hg

hg

hg • Where is the trunk?

• Run testing, deployment builds

• What happens if you go dark?• What about security?

• How do I add or remove users?

• Where is the backup that we will use when the building burns down?

Page 7: Mercurial

hg

The Blessed Repo Workflow

hg

hg

hg

hg

hg

hg

Build server runs against blessed

repo

WI against this

Backup this

Central Management

Here

Familiar model

Page 8: Mercurial

The Hybrid Blessed Repo Workflow

SVN

hg

hg

hg

hg

hg

hg

Mercu

rial to

SV

N

Brid

ge

Page 9: Mercurial

Network of Trust Workflow

hg

hg

hg

hg

hg

hg

King

Lie

ute

nan

tsU

nw

ash

ed

Masses

Graphics Networks Disk Penguins

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

Page 10: Mercurial

Corporate Network of Trust Workflow

hg

hg

hg

hg

hg

Seniors

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

Juniors

hg

hg

hg

hg

hg

hg

hg

hg

Intermediates

Page 11: Mercurial

Deployment Team Workflow

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

hg

Deploy

Development

Pre-Prod

hg

hg

hg

hg

hg

hg

Can run own workflows

Can have own build and ship quality

gates

Can have own branching strategy

Page 12: Mercurial

Proven Practises Alignment?Branching

Plan your branchingOwn the mergeLook after branches

RepoDon’t break the buildSeparate your repoDon’t forget to shelveUse labels

TechTry concurrent accessDon’t be afraid of branching conceptsAuto merge for checkout only

ManagementDon’t use the audit trail for blameUseful & meaningful check in messages

YouBe light and quick with checkoutsKeep up to dateDon’t check in unneeded binariesWorking folders should be disposableUse undo/revert sparingly

Page 13: Mercurial

Commands (51)

Add, AddRemove, Remove [rm]Annotate [Blame]ArchiveBackoutBisectBookmarksBranch & BranchesBundle & UnbundleCatCloneCommit [ci]Copy [cp] & Rename [move, mv]Diff

Export & Import [patch]ForgetGrepHeadsHelpIdentify [id]Incoming [in] & Outgoing [out]InitLocateLog [history]ManifestMerge & ResolveParentsPath

Pull & PushRecoverRevertRollbackRootServeShowConfig [debugconfig]Status [st]Summary [sum]Tag & TagsTipUpdate [up, checkout, co]VerifyVersion

Page 14: Mercurial

Command Cheat Sheet

Page 15: Mercurial

Other DVCS Options

• Git– Linus Torvalds– Linux Kernal– Requires packing

maintenance– Unfriendly version numbers– FAST– Linux & Mac– Different patching ideology – No working set issue– Can delete branches

• Bazaar– Canonicial– Ubuntu– Slow– Closer to SVN

• Monotone, Darcs, Plastic, SVK, Codeville, GNU arch, Bitkeeper

Page 16: Mercurial

Questions?