Dvcs With Mercurial (No Notes)

5,780 views
5,627 views

Published on

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

Published in: Technology
1 Comment
5 Likes
Statistics
Notes
No Downloads
Views
Total views
5,780
On SlideShare
0
From Embeds
0
Number of Embeds
877
Actions
Shares
0
Downloads
143
Comments
1
Likes
5
Embeds 0
No embeds

No notes for slide

Dvcs With Mercurial (No Notes)

  1. 1. Distributed Source Control With Mercurial Or, How I Learned to Stop Worrying and Love the Merge Ted Naleid - Lead Developer at Carol.com
  2. 2. Overview • Introduction • SVN (centralized VCS) vs DVCS • Current Popular DVCS Alternatives • Mercurial (hg) examples • Hands on with hg
  3. 3. checkout add remove update remote log central commit repos merge ... Build Server Centralized VCS (SVN)
  4. 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. 5. SVN Limitations DVCS/Mercurial Strengths
  6. 6. Branching is easy, but merging is painful Branching is easy, merging is (relatively) easy
  7. 7. Active net connection required to interact If your computer is on, you have access to the repository
  8. 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. 9. Fails to merge changes when something is renamed Aware of file history and can merge into renamed file
  10. 10. .svn files are littered throughout your source tree Single .hg directory at root of source tree
  11. 11. Slow over-the-wire performance Fast performance; you’re working on local filesystem
  12. 12. Discourages experimentation Cheap to create/throw away local experimental branch
  13. 13. SVN Strengths DVCS/Mercurial Limitations
  14. 14. Familiar to most developers Most developers will need to learn to think differently
  15. 15. Relatively easy to grasp Better understanding of version control concepts required
  16. 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. 17. Well established tool support and integration Tool support and integration isn’t quite as far along
  18. 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. 19. Popular 2nd Gen DVCS Systems Git - Bazaar - Mercurial
  20. 20. Git Created by Linus Torvalds in 2005 after the BitKeeper “debacle”
  21. 21. Git - Website & Hosting • Website: http://git.or.cz/ • Hosting: • http://github.com • http://repo.or.cz
  22. 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. 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. 24. Bazaar (bzr) Created by Canonical, Ltd. (creators of Ubuntu) in 2005
  25. 25. Bazaar - Website & Hosting • Website: http://bazaar-vcs.org/ • Hosting: https://launchpad.net/
  26. 26. Bazaar - Use in the Wild • Ubuntu • Drupal • Fairly big in Python community • it’s written mostly in Python
  27. 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. 28. Mercurial (hg) Created by Matt Mackall in 2005 after the BitKeeper “debacle”
  29. 29. Mercurial - Website & Hosting • Website: http://www.selenic.com/mercurial/ • Hosting: • http://freehg.org/ • http://sharesource.org/
  30. 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. 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. 32. Why did I choose Mercurial over Git/Bazaar?
  33. 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. 34. Better cross platform support and growing tool integration
  35. 35. No “packing” of the repository is necessary
  36. 36. Local revision numbers are “friendly”
  37. 37. It’s used by a number of big Java projects
  38. 38. It’s the first one I tried :)
  39. 39. All 3 of these tools look fantastic.
  40. 40. Mercurial Usage Examples How do I do X?
  41. 41. portal/** portal/.hg hg init local local file hg addremove repos system hg commit Create a new repository
  42. 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. 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. 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. 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. 46. http://hg01/repos/portal portal/.hg hg incoming remote local repos repos hg outgoing Do a push/pull dry run
  47. 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. 48. local file changes portal/.hg local hg diff file hg status local system hg identify repos Compare file system with repository
  49. 49. portal/.hg hg log hg annotate hg cat local hg grep repos hg serve Query repository for info
  50. 50. Hands on with Hg
  51. 51. Creating new repository
  52. 52. Cloning repository/ branching
  53. 53. Pushing changes to another repository
  54. 54. Merging conflicting changes
  55. 55. Creating a tag
  56. 56. Searching through history
  57. 57. Viewing repository through a web browser
  58. 58. A quick way to stick your toes in and try Mercurial out: use it as a “Super Client” for SVN
  59. 59. Web Resources • Choosing a distributed version control system http://www.dribin.org/dave/blog/archives/2007/12/28/dvcs/ • Understanding Mercurial http://www.selenic.com/mercurial/wiki/index.cgi/UnderstandingMercurial • Version Control and the “80%” (DVCS counterpoint) http://blog.red-bean.com/sussman/?p=79 • Mercurial Book http://hgbook.red-bean.com/hgbook.html • Video of Bryan O’Sullivan (creator of the Mercurial Book) http://video.google.com/videoplay?docid=-7724296011317502612
  60. 60. Questions?

×