Your SlideShare is downloading. ×
Dvcs With Mercurial (No Notes)
Upcoming SlideShare
Loading in...5

Thanks for flagging this SlideShare!

Oops! An error has occurred.

Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Dvcs With Mercurial (No Notes)


Published on

Distributed Version Control with Mercurial presentation (without notes, easier to see on slideshare).

Distributed Version Control with Mercurial presentation (without notes, easier to see on slideshare).

Published in: Technology

1 Comment
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

No notes for slide


  • 1. Distributed Source Control With Mercurial Or, How I Learned to Stop Worrying and Love the Merge Ted Naleid - Lead Developer at
  • 2. Overview • Introduction • SVN (centralized VCS) vs DVCS • Current Popular DVCS Alternatives • Mercurial (hg) examples • Hands on with hg
  • 3. checkout add remove update remote log central commit repos merge ... Build Server Centralized VCS (SVN)
  • 4. Alice's repos push add pull remove update push Dave's log Bob's pull repos commit repos diff push merge pull ... build repos Build Server Distributed VCS (Mercurial)
  • 5. SVN Limitations DVCS/Mercurial Strengths
  • 6. Branching is easy, but merging is painful Branching is easy, merging is (relatively) easy
  • 7. Active net connection required to interact If your computer is on, you have access to the repository
  • 8. Unable to share changes with others without sharing with everyone (including the build server) Sharing changes with selected people is easy (hg serve/hg push/hg pull)
  • 9. Fails to merge changes when something is renamed Aware of file history and can merge into renamed file
  • 10. .svn files are littered throughout your source tree Single .hg directory at root of source tree
  • 11. Slow over-the-wire performance Fast performance; you’re working on local filesystem
  • 12. Discourages experimentation Cheap to create/throw away local experimental branch
  • 13. SVN Strengths DVCS/Mercurial Limitations
  • 14. Familiar to most developers Most developers will need to learn to think differently
  • 15. Relatively easy to grasp Better understanding of version control concepts required
  • 16. Everyone knows where the trunk is because there’s only one server Need to define and adhere to convention to know where the trunk is
  • 17. Well established tool support and integration Tool support and integration isn’t quite as far along
  • 18. There is a winner among free, centralized VCS systems: Subversion DVCS systems are still new and a clear winner has not been established
  • 19. Popular 2nd Gen DVCS Systems Git - Bazaar - Mercurial
  • 20. Git Created by Linus Torvalds in 2005 after the BitKeeper “debacle”
  • 21. Git - Website & Hosting • Website: • Hosting: • •
  • 22. Git - Use in the Wild • Linux Kernel • One Laptop Per Child (OLPC) • Ruby on Rails • Lots of other Ruby stuff • Written mostly in C
  • 23. Git - Common Wisdom • Fastest of the DVCS systems • Unfriendly to non-Linux/Unix systems • Complex, with ~150 commands added to path • Very popular in the Linux/Ruby communities • Probably the most “buzz” off all DVCS systems right now
  • 24. Bazaar (bzr) Created by Canonical, Ltd. (creators of Ubuntu) in 2005
  • 25. Bazaar - Website & Hosting • Website: • Hosting:
  • 26. Bazaar - Use in the Wild • Ubuntu • Drupal • Fairly big in Python community • it’s written mostly in Python
  • 27. Bazaar - Common Wisdom • Has gone through lots of revisions/changed formats • Slowest of the 3 • Migration of an existing SVN repository is REALLY slow • Made to be friendly, similar to SVN • Smallest market share
  • 28. Mercurial (hg) Created by Matt Mackall in 2005 after the BitKeeper “debacle”
  • 29. Mercurial - Website & Hosting • Website: • Hosting: • •
  • 30. Mercurial - Use in the Wild • OpenJDK (Java) • OpenSolaris • Mozilla • NetBeans • Many others (largely Java/Python related) • Like Bazaar, it’s mostly written in Python
  • 31. Mercurial - Common Wisdom • Similar syntax to SVN • Slightly slower than Git, but faster than Bazaar • Good cross-platform support • Getting good support from large Java projects (OpenJDK, NetBeans, etc) • Lower maintenance and easier learning curve than Git
  • 32. Why did I choose Mercurial over Git/Bazaar?
  • 33. Similar commands to SVN • hg add • hg remove • hg update • hg log • hg status • It’s like SVN but with the ability to “push” and “pull”
  • 34. Better cross platform support and growing tool integration
  • 35. No “packing” of the repository is necessary
  • 36. Local revision numbers are “friendly”
  • 37. It’s used by a number of big Java projects
  • 38. It’s the first one I tried :)
  • 39. All 3 of these tools look fantastic.
  • 40. Mercurial Usage Examples How do I do X?
  • 41. portal/** portal/.hg hg init local local file hg addremove repos system hg commit Create a new repository
  • 42. portal/** portal/.hg http://hg01/repos/portal local creates tip files local remote file hg clone on filesystem repos repos system hg clone http://hg01/repos/portal “Checkout” an Existing Repository
  • 43. portal/** portal/.hg http://hg01/repos/portal local hg pull local remote file hg update repos repos system quot;hg pull -uquot; will do this in one command Pull down the latest changes (no conflicts with local changes)
  • 44. local file changes portal/.hg http://hg01/repos/portal hg commit conflict! hg pull local files unchanged! hg update local remote file hg merge repos repos system hg commit quot;hg fetchquot; will pull->update->merge->commit in one command Pull down the latest changes (conflicts detected with local changes)
  • 45. local file changes portal/.hg http://hg01/repos/portal hg add local hg remove hg addremove local remote file repos hg commit repos system hg push Push changes to another repository (by default, push will refuse to run if it would require a merge)
  • 46. http://hg01/repos/portal portal/.hg hg incoming remote local repos repos hg outgoing Do a push/pull dry run
  • 47. portal/.hg local Branching is done by repos simply cloning a repository hg clone hg clone portal portal-clone portal-clone/** portal-clone/.hg local creates tip files local file on filesystem repos system Create a new “branch” (experimenting is cheap and easy)
  • 48. local file changes portal/.hg local hg diff file hg status local system hg identify repos Compare file system with repository
  • 49. portal/.hg hg log hg annotate hg cat local hg grep repos hg serve Query repository for info
  • 50. Hands on with Hg
  • 51. Creating new repository
  • 52. Cloning repository/ branching
  • 53. Pushing changes to another repository
  • 54. Merging conflicting changes
  • 55. Creating a tag
  • 56. Searching through history
  • 57. Viewing repository through a web browser
  • 58. A quick way to stick your toes in and try Mercurial out: use it as a “Super Client” for SVN
  • 59. Web Resources • Choosing a distributed version control system • Understanding Mercurial • Version Control and the “80%” (DVCS counterpoint) • Mercurial Book • Video of Bryan O’Sullivan (creator of the Mercurial Book)
  • 60. Questions?