2010
The Subversion Dilemma Check in buggy code and drive everyone else crazy Avoid checking it in until it’s fully debugged or
The Subversion Dilemma Weeks without Version Control
Jens Schumacher – Atlassian What is DVCS and why it will change the way we work 2010
Overview 1. Mercurial vs. Subversion 2. Basic concepts 3. Use cases
Subversion vs Mercurial
Merging
Subversion vs Mercurial Branching
Subversion vs Mercurial Repository Access
Subversion vs Mercurial Performance
Subversion vs Mercurial Sharing
Subversion vs Mercurial Tool Support
Subversion vs Mercurial Authentication
Subversion vs Mercurial Check Out
Subversion vs Mercurial
Overview 1. Mercurial vs. Subversion 2. Basic concepts 3. Use cases
Repository Architecture
Subversion
Mercurial
Subversion Revisions Subversion is always linear
Mercurial Changesets head Each Changeset can have multiple children
Mercurial head
Mercurial Pull Merge
Mercurial "hg commit" adds a new node "hg push" and "hg pull" transfer nodes in the graph between two repositories "hg merge" merge changes in a repository
Branching in Mercurial Forks Named Branches Bookmarks Anonymous Branches
Forks
Complete Isolation Very easy to discard Forking is slower DisadvantagesAdvantages 12
Forks When to use Forks When you don’t have commit access To experiment For a build repository
Named Branches
Branch Metadata Faster than Forking Branch Metadata Closing a Branch (fixed in 1.2) DisadvantagesAdvantages
Named Branches When to use Named Branches Working in a team on a feature
Bookmarks
Lightweight Can be deleted Similar to git Local (fixed in 1.6) Possible loss of context DisadvantagesAdvantages
Bookmarks When to use Bookmarks Working in a team on a feature If you like to way git does branching If you use Mercurial 1.6
Anonymous Branches
Fast No name required No closing required No description Changeset # required (lookup with hg log) DisadvantagesAdvantages
Anonymous Branches When to use Anonymous Branches For quick & small fixes
Overview 1. Mercurial vs. Subversion 2. Basic concepts 3. Use cases
BitBucket Mercurial code hosting Free for 5 users Unlimited public collaborators Unlimited disk space
Getting Started
The Basics hg init create a new repositoryhg commit save your changes in the current repositoryhg log see all changes in your repositoryhg pull pull all changes from another repository into yourshg push push your changes into another repositoryhg merge join different lines of history hg update update the repository's working directoryhg help repositoryrectoryhg help <c
Separate Features Use Case Work on several features in parallel
Separate Features $ hg clone project feature$ cd feature$ (do some changes and commits) Clone
Separate Features $ cd../project$ hg incoming../feature Incoming Use hg incoming --patch to view the diffs
Separate Features $ hg pull../feature Pull The history of feature one is now in your project. However, changes are not yet visible and only stored in the.hg directory
Separate Features $ hg merge Merge $ hg commit(enter commit message) Commit
Separate Features Changesets
Collaborative Feature Development Use Case Using Mercurial to help coordinate the coding
Collaborative Feature Development $ hg branch feature(do some changes)$ hg commit(write commit message) Create a branch $ hg update feature(do some changes)$ hg commit(write commit message)
Collaborative Feature Development $ hg update default$ hg merge feature$ hg commit(write commit message) Merge the named branch Named branches stay in history as permanent records after you finished your work.
Collaborative Feature Development Changesets
Tagging Revisions Use Case Release a plugin
Tagging Revisions $ hg tag -r 8 v0.1 Add a tag $ hg tags See all tags $ hg update v0.1 Update to a tagged revision
Tagging Revisions Tags
Overview 1. Mercurial vs. Subversion 2. Basic concepts 3. Use cases
Try BitBucket bitbucket.org
Links branching-in-mercurial branching-in-mercurial
Thank you!