Mercurial DVCS presentation to DevJam 11/4/2009

6,129 views
6,031 views

Published on

Mercurial DVCS presentation given to Minneapolis, MN DevJam meeting on 11/4/2009.

Published in: Technology
1 Comment
13 Likes
Statistics
Notes
No Downloads
Views
Total views
6,129
On SlideShare
0
From Embeds
0
Number of Embeds
432
Actions
Shares
0
Downloads
157
Comments
1
Likes
13
Embeds 0
No embeds

No notes for slide

Mercurial DVCS presentation to DevJam 11/4/2009

  1. 1. distributed version control with mercurial or: how I learned to stop worrying and love the merge Presented by Ted Naleid Wednesday, November 4, 2009
  2. 2. overview robust and mature “centralized” and “distributed” advantages over subversion why svn merging is broken subversion’s advantages comparison to git concepts basic usage how to get started Wednesday, November 4, 2009
  3. 3. mercurial is robust and mature Wednesday, November 4, 2009
  4. 4. large projects Python Mozilla NetBeans OpenOffice OpenSolaris OpenJDK Symbian OS Xen Hypervisor Wednesday, November 4, 2009
  5. 5. cross platform support great command line on win/mac/linux standalone GUIs windows - TortiseHG mac - murky linux - hgk Wednesday, November 4, 2009
  6. 6. IDE support IntelliJ Eclipse NetBeans Visual Studio TextMate BBEdit emacs vi Wednesday, November 4, 2009
  7. 7. continuous integration and bug tracking Hudson Cruise Control BuildBot Bamboo TeamCity JIRA Trac FogBugz/Kiln + support in maven and ant Wednesday, November 4, 2009
  8. 8. internet hosting bitbucket Google Code SourceForge kenai (Sun) Wednesday, November 4, 2009
  9. 9. Build Server commit Remote update Repo centralized version control systems Wednesday, November 4, 2009
  10. 10. Build Server Build Repo sh pu ll pu commit Alice's Carl's update Repo Repo Bob's Repo distributed version control system Wednesday, November 4, 2009
  11. 11. Build Server Build Repo sh pu ll pu commit push Alice's Carl's update Repo pull Repo pu sh pu ll Bob's Repo distributed version control system Wednesday, November 4, 2009
  12. 12. subversion limitations mercurial strengths Wednesday, November 4, 2009
  13. 13. shared remote repository owned local repository Wednesday, November 4, 2009
  14. 14. requires active net connection always available Wednesday, November 4, 2009
  15. 15. slow over-the-wire access speedy local access Wednesday, November 4, 2009
  16. 16. single point of failure multiple redundant copies Wednesday, November 4, 2009
  17. 17. working with branches is slow and painful simple, in-place branch switching hg update branch_name Wednesday, November 4, 2009
  18. 18. expensive public branches discourage experimentation cheap, easy branches encourage experimentation Wednesday, November 4, 2009
  19. 19. saving state is intertwined with releasing save whenever, push out when it’s ready Wednesday, November 4, 2009
  20. 20. would you use a word processor that only let you save at the end of a paragraph? Wednesday, November 4, 2009
  21. 21. litters workspace with .svn directories single .hg directory at project root Wednesday, November 4, 2009
  22. 22. time to set up new repository limits use instant setup enables new uses hg init hg add hg commit -m “first commit” Wednesday, November 4, 2009
  23. 23. merging is messy, dangerous and often avoided merging is the core operation so it’s done well Wednesday, November 4, 2009
  24. 24. why is subversion merging so broken and scary? Wednesday, November 4, 2009
  25. 25. #1 when there are conflicts, you’re forced to merge into an unsaved working copy Wednesday, November 4, 2009
  26. 26. #2 when there are no conflicts, you aren’t forced to merge this is a bug, not a feature Wednesday, November 4, 2009
  27. 27. in mercurial, you commit before pulling new code only fully formed changes get pushed out history is always preserved Wednesday, November 4, 2009
  28. 28. merging is a common, trivial operation a merge occurs every time you pull down new code Wednesday, November 4, 2009
  29. 29. subversion strengths mercurial limitations Wednesday, November 4, 2009
  30. 30. familiar new ideas require understanding Wednesday, November 4, 2009
  31. 31. very strong tool support tool support not as mature Wednesday, November 4, 2009
  32. 32. better choice for lots of huge binary files not optimal for huge binary files Wednesday, November 4, 2009
  33. 33. everyone knows where the canonical repository is convention defines where to push/pull from Wednesday, November 4, 2009
  34. 34. checking out part of a repository is easy no easy way to get only part of a repository Wednesday, November 4, 2009
  35. 35. allows empty directories tracks files, so empty directories aren’t saved Wednesday, November 4, 2009
  36. 36. subversion is the clear leader in free centralized version control annoying holy war raging over hg vs. git Wednesday, November 4, 2009
  37. 37. mercurial git Wednesday, November 4, 2009
  38. 38. easy local md5 is easy, revision numbers right? Wednesday, November 4, 2009
  39. 39. plugin design with kitchen sink basic default functionality design Wednesday, November 4, 2009
  40. 40. better slower http performance over performance, no http, built-in quick easy built-in server serverhg serve Wednesday, November 4, 2009
  41. 41. works well on windows support windows, mac, is lacking and and linux low priority Wednesday, November 4, 2009
  42. 42. history is rewriting history sacred is a badge of (though you can commit sacrilege with plugins) honor Wednesday, November 4, 2009
  43. 43. mercurial concepts Wednesday, November 4, 2009
  44. 44. change sets are stored as nodes in a DAG (directed acyclic graph) tip newest r3 file system version r2 time r1 oldest r0 Wednesday, November 4, 2009
  45. 45. a change set with no children is a “head” r3 r2 r1 r0 Wednesday, November 4, 2009
  46. 46. change sets have zero, one or two parents Wednesday, November 4, 2009
  47. 47. the root has zero parents r4 r3 r2 r1 r0 Wednesday, November 4, 2009
  48. 48. normal commits have one parent r4 r3 r2 r1 r0 Wednesday, November 4, 2009
  49. 49. merges have two parents r4 r3 r2 r1 r0 Wednesday, November 4, 2009
  50. 50. branch name is determined by the first parent r4 branch: default r4 branch: release_1.x r3 branch: release_1.x r3 branch: release_1.x r2 branch: default r2 branch: default r1 r1 r0 r0 first parent is r2 first parent is r3 Wednesday, November 4, 2009
  51. 51. history is immutable Wednesday, November 4, 2009
  52. 52. merging only happens in your local repository Wednesday, November 4, 2009
  53. 53. that’s it! Wednesday, November 4, 2009
  54. 54. mercurial usage Wednesday, November 4, 2009
  55. 55. hg status <-> svn status hg log <-> svn log hg diff <-> svn diff hg cat <-> svn cat familiar basic hg hg blame add <-> <-> svn svn blame add commands hg hg hg remove rename update <-> <-> <-> svn svn svn remove rename update hg resolve <-> svn resolve hg commit <-> svn commit hg merge <-> svn merge Wednesday, November 4, 2009
  56. 56. hg init hg add hg commit -m “project start” create a new r0 “project start” repository Wednesday, November 4, 2009
  57. 57. <changes ...> hg commit -m “created domain” commit changes to your r1 “created domain” local repository r0 “project start” Wednesday, November 4, 2009
  58. 58. <more changes...> hg commit -m “updated user” commit changes to your r2 “updated user” local repository r1 “created domain” r0 “project start” Wednesday, November 4, 2009
  59. 59. hg update -r 1 switch your file system to a r2 “updated user” different revision r1 “created domain” r0 “project start” Wednesday, November 4, 2009
  60. 60. hg branch release_1.0.x <changes...> hg commit -m “fix role” “fix role” r3 branch: release_1.x create a branch r2 “updated user” branch: default “created domain” r1 branch: default “project start” r0 branch: default Wednesday, November 4, 2009
  61. 61. hg update default “fix role” r3 branch: release_1.x merge changes r2 “updated user” branch: default from a branch r1 “created domain” branch: default “project start” r0 branch: default Wednesday, November 4, 2009
  62. 62. hg merge release_1.x <resolve any conflicts> hg commit -m “merged branch” r4 “merged branch” “fix role” r3 branch: release_1.x merge changes r2 “updated user” from a branch r1 “created domain” r0 “project start” Wednesday, November 4, 2009
  63. 63. hg clone http://path.to.repo get an existing b b repository a a remote local Wednesday, November 4, 2009
  64. 64. hg pull get the latest c changes from b b another repository a remote a local Wednesday, November 4, 2009
  65. 65. hg pull pull adds c c changes but b b doesn’t modify file system a remote a local Wednesday, November 4, 2009
  66. 66. hg update update your c c working directory b b with the changes a a remote local Wednesday, November 4, 2009
  67. 67. what if you’ve already made a change in your repository? Wednesday, November 4, 2009
  68. 68. hg pull we added c to b d c b b they added d to b a a remote local Wednesday, November 4, 2009
  69. 69. hg pull d d c pulling in d gives b b us a new head a a remote local Wednesday, November 4, 2009
  70. 70. hg update # abort, crosses branches d when we try to d c update to the tip, b b hg says you need to merge a remote a local Wednesday, November 4, 2009
  71. 71. hg merge <resolve any conflicts> hg commit -m “merge done” e d d c merge the b b changes together a a remote local hg fetch does all this in one command (pull, update, merge, commit) use that instead Wednesday, November 4, 2009
  72. 72. hg push e d d c push changes b b back out a a remote local Wednesday, November 4, 2009
  73. 73. hg push e e d d c c push changes b b back out a a remote local Wednesday, November 4, 2009
  74. 74. how to get started with mercurial Wednesday, November 4, 2009
  75. 75. watch the peepcode screencast $9, cheap! Wednesday, November 4, 2009
  76. 76. read the book free online! Wednesday, November 4, 2009
  77. 77. install it Wednesday, November 4, 2009
  78. 78. start small Wednesday, November 4, 2009
  79. 79. convert your existing repository Wednesday, November 4, 2009
  80. 80. commit and share often Wednesday, November 4, 2009
  81. 81. install and learn to use a 3-way merge tool Wednesday, November 4, 2009
  82. 82. profit! Wednesday, November 4, 2009
  83. 83. links mercurial wiki/download http://mercurial.selenic.com O’Reilly’s Mercurial - The Definitive Guide http://hgbook.red-bean.com/ (free!) peepcode intro screencast ($9) http://peepcode.com/products/meet-mercurial mercurial branching info http://stevelosh.com/blog/entry/2009/8/30/a-guide-to-branching-in-mercurial/ ACM article on DVCS http://preview.tinyurl.com/qezmta Wednesday, November 4, 2009
  84. 84. Questions? Wednesday, November 4, 2009

×