Private and Confidential Private and Confidential July 7, 2011 Private and Confidential Intro to Mercurial (Hg) May 2011  ...
Private and Confidential Private and Confidential Agenda: Help! I'm Time Boxed! <ul><li>30 minutes (hopefully) </li></ul><...
Private and Confidential Why Mercurial (Hg) and not Git?  <ul><ul><li>Easier adoption: </li></ul></ul><ul><ul><ul><li>Hg i...
Mercurial Concepts: DVCS <ul><ul><li>DVCS:  Distributed  Version Control System </li></ul></ul><ul><ul><ul><li>No central ...
Mercurial Terminology <ul><ul><li>Head </li></ul></ul><ul><ul><ul><li>Latest commit on a branch. </li></ul></ul></ul><ul><...
Mercurial Concepts: Commits <ul><ul><li>Commits are  local . </li></ul></ul><ul><ul><li>Pushes are  remote . </li></ul></u...
Mercurial Concepts: Workflow <ul><ul><li>Clone the repo to local. Just once. </li></ul></ul><ul><ul><ul><li>hg clone  http...
Mercurial Concepts: Workflow (2) <ul><li>Typical workflow (the real one): </li></ul><ul><ul><li>Code </li></ul></ul><ul><u...
Mercurial Concepts: Branching <ul><ul><li>CVS: branches are sticky tags. </li></ul></ul><ul><ul><li>Mercurial: branches ar...
Mercurial Concepts: Branching Visualized
Mercurial at Points <ul><ul><li>When? Soon. Now, if you ask nicely. </li></ul></ul><ul><ul><li>Get ready.  </li></ul></ul>...
Mercurial at Points: Branching <ul><ul><li>Branch naming conventions: </li></ul></ul><ul><ul><ul><li>Do  not  use 'default...
Mercurial at Points: Branching (2) <ul><ul><li>Builds promoted from dev to prod. </li></ul></ul>
Mercurial at Points: Branching (3) <ul><ul><li>Within teams, new feature, hot fixes, etc. on branches. </li></ul></ul>
Mercurial Concepts: Features You'll Love <ul><ul><li>Go back in time -- almost instantly! </li></ul></ul><ul><ul><ul><li>h...
Mercurial: Q&A <ul><li>Silence = You Understood Everything  </li></ul><ul><li>                 and Won't Ask Me Later. </l...
Further Reading <ul><ul><li>Official docs:  http://mercurial.selenic.com/learn/   </li></ul></ul><ul><ul><ul><li>PLEASE RE...
Upcoming SlideShare
Loading in...5
×

Points.com intro to mercurial hg 2011

1,440

Published on

Points.com introduction to Mercurial (Hg). May 2011. See: lifeatpoints.com

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,440
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
19
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Points.com intro to mercurial hg 2011

  1. 1. Private and Confidential Private and Confidential July 7, 2011 Private and Confidential Intro to Mercurial (Hg) May 2011 Prepared by Michael Lossos He likes Git, too.
  2. 2. Private and Confidential Private and Confidential Agenda: Help! I'm Time Boxed! <ul><li>30 minutes (hopefully) </li></ul><ul><li>Why Mercurial and not Git? </li></ul><ul><li>Mercurial Concepts </li></ul><ul><li>Mercurial Branching </li></ul><ul><li>Mercurial at Points </li></ul><ul><li>Q&A </li></ul>
  3. 3. Private and Confidential Why Mercurial (Hg) and not Git? <ul><ul><li>Easier adoption: </li></ul></ul><ul><ul><ul><li>Hg is easier to learn. (Really.) </li></ul></ul></ul><ul><ul><ul><li>Hg commands are more like Subversion. </li></ul></ul></ul><ul><ul><li>Your experience: </li></ul></ul><ul><ul><ul><li>Many of you have used Subversion or Mercurial. </li></ul></ul></ul><ul><ul><ul><li>Few of you have used Git. </li></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>Hg's Windows / Eclipse tools are better than Git's.  </li></ul></ul><ul><ul><li>SurveyMonkey said: </li></ul></ul><ul><ul><ul><li>40% Hg </li></ul></ul></ul><ul><ul><ul><li>40% Git </li></ul></ul></ul><ul><ul><ul><li>20% Don't Care </li></ul></ul></ul><ul><li>  </li></ul>
  4. 4. Mercurial Concepts: DVCS <ul><ul><li>DVCS: Distributed Version Control System </li></ul></ul><ul><ul><ul><li>No central repo required. </li></ul></ul></ul><ul><ul><ul><li>No network connection required. (Local) </li></ul></ul></ul><ul><ul><li>Everybody gets a clone ! </li></ul></ul><ul><ul><ul><li>Local .hg dir: copy of remote repo. </li></ul></ul></ul><ul><ul><ul><li>All repo history is available locally. </li></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>Massively parallel development. </li></ul></ul><ul><ul><ul><li>  Git: </li></ul></ul></ul><ul><ul><ul><ul><li>Linux, Android </li></ul></ul></ul></ul><ul><ul><ul><li>  Mercurial: </li></ul></ul></ul><ul><ul><ul><ul><li>Python, Mozilla, OpenJDK </li></ul></ul></ul></ul><ul><li>  </li></ul>
  5. 5. Mercurial Terminology <ul><ul><li>Head </li></ul></ul><ul><ul><ul><li>Latest commit on a branch. </li></ul></ul></ul><ul><ul><ul><li>Can be multiple heads. </li></ul></ul></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>  </li></ul><ul><li>                                                              http://mercurial.selenic.com/wiki/Head </li></ul><ul><ul><li>Tip </li></ul></ul><ul><ul><ul><li>Latest commit in a repo. </li></ul></ul></ul><ul><ul><li>Working directory </li></ul></ul><ul><ul><ul><li>Local copy of files/dirs from the repo. </li></ul></ul></ul>
  6. 6. Mercurial Concepts: Commits <ul><ul><li>Commits are local . </li></ul></ul><ul><ul><li>Pushes are remote . </li></ul></ul><ul><ul><ul><li>Send commit(s) to remote repo. </li></ul></ul></ul><ul><ul><ul><li>2 steps to share with others: commit, push . </li></ul></ul></ul><ul><ul><li>Pushes are atomic (think ACID) </li></ul></ul><ul><ul><ul><li>No more 8-ball germs. </li></ul></ul></ul><ul><ul><li>Pushes are permanent.  </li></ul></ul><ul><ul><ul><li>This isn't Git. </li></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>Changesets are the commit unit: </li></ul></ul><ul><ul><ul><li>File Contents and Paths </li></ul></ul></ul><ul><ul><ul><li>Unique ids: 82:853a723193a6 </li></ul></ul></ul>
  7. 7. Mercurial Concepts: Workflow <ul><ul><li>Clone the repo to local. Just once. </li></ul></ul><ul><ul><ul><li>hg clone  https://hg.points.com/hgweb.cgi/yourRepo/ </li></ul></ul></ul><ul><ul><li>Change to your dev branch. </li></ul></ul><ul><ul><ul><li>hg update dev_bgt_xxxxx </li></ul></ul></ul><ul><ul><li>Typical workflow: </li></ul></ul><ul><ul><ul><li>Code </li></ul></ul></ul><ul><ul><ul><li>Commit locally :  </li></ul></ul></ul><ul><ul><ul><ul><li>hg commit </li></ul></ul></ul></ul><ul><ul><ul><li>Code more. Commit more. All local . </li></ul></ul></ul><ul><ul><ul><li>Ready to share? Push to remote repo.    </li></ul></ul></ul><ul><ul><ul><ul><li>hg push </li></ul></ul></ul></ul>
  8. 8. Mercurial Concepts: Workflow (2) <ul><li>Typical workflow (the real one): </li></ul><ul><ul><li>Code </li></ul></ul><ul><ul><li>Commit (local) </li></ul></ul><ul><ul><li>Outgoing: preview what will be sent on push. </li></ul></ul><ul><ul><ul><li>hg outgoing </li></ul></ul></ul><ul><ul><li>Push : FAIL  </li></ul></ul><ul><ul><ul><li>  abort: push creates new remote heads! </li></ul></ul></ul><ul><ul><li>Someone beat you to push!  </li></ul></ul><ul><ul><li>Pull </li></ul></ul><ul><ul><ul><li>hg pull </li></ul></ul></ul><ul><ul><li>Update / Merge </li></ul></ul><ul><ul><ul><li>hg update </li></ul></ul></ul><ul><ul><ul><li>OR    </li></ul></ul></ul><ul><ul><ul><li>hg pull --update      To update immediately after pull. </li></ul></ul></ul><ul><ul><li>Commit </li></ul></ul><ul><ul><li>Push </li></ul></ul>
  9. 9. Mercurial Concepts: Branching <ul><ul><li>CVS: branches are sticky tags. </li></ul></ul><ul><ul><li>Mercurial: branches are lines of parent/child changesets. </li></ul></ul><ul><ul><li>Branch names are &quot;sticky&quot;. </li></ul></ul><ul><ul><ul><li>Parent lineage known. </li></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>Default branch is called: </li></ul></ul><ul><ul><ul><li>'default' </li></ul></ul></ul><ul><ul><ul><li>Vaguely like CVS HEAD (not really). </li></ul></ul></ul><ul><ul><ul><li>We won't use 'default'. </li></ul></ul></ul><ul><li>  </li></ul><ul><ul><li>Example branch name: </li></ul></ul><ul><ul><ul><li>dev_bgt_giftregistry_rc </li></ul></ul></ul>
  10. 10. Mercurial Concepts: Branching Visualized
  11. 11. Mercurial at Points <ul><ul><li>When? Soon. Now, if you ask nicely. </li></ul></ul><ul><ul><li>Get ready.  </li></ul></ul><ul><ul><ul><li>Please start learning now: </li></ul></ul></ul><ul><ul><ul><li>https://wikixxxxxx.points.com/wiki/Mercurial </li></ul></ul></ul><ul><ul><li>How? </li></ul></ul><ul><ul><ul><li>TortoiseHg </li></ul></ul></ul><ul><ul><ul><li>Eclipse 3.6 with HGE (Mercurial Eclipse) plugin. </li></ul></ul></ul><ul><ul><ul><ul><li>Coming soon to Points. </li></ul></ul></ul></ul><ul><ul><li>Who? Where do you get help? </li></ul></ul><ul><ul><ul><li>Ask your team lead. </li></ul></ul></ul><ul><ul><ul><li>Ask around: </li></ul></ul></ul><ul><ul><ul><ul><li>BGT devs, Shared Services devs. </li></ul></ul></ul></ul>
  12. 12. Mercurial at Points: Branching <ul><ul><li>Branch naming conventions: </li></ul></ul><ul><ul><ul><li>Do not use 'default' branch. </li></ul></ul></ul><ul><ul><li>Do not name branches (usually). </li></ul></ul><ul><ul><ul><li>Until asked. </li></ul></ul></ul><ul><ul><li>Named branches: feature dev, build promotions. </li></ul></ul><ul><ul><ul><li>prod_head </li></ul></ul></ul><ul><ul><ul><li>staging_head </li></ul></ul></ul><ul><ul><ul><li>dev_bgt_giftregistry </li></ul></ul></ul><ul><ul><li>New heads: </li></ul></ul><ul><ul><ul><li>Inherit parent branch name (e.g. 'default') </li></ul></ul></ul><ul><ul><ul><li>Bookmarks for tracking lines. </li></ul></ul></ul>
  13. 13. Mercurial at Points: Branching (2) <ul><ul><li>Builds promoted from dev to prod. </li></ul></ul>
  14. 14. Mercurial at Points: Branching (3) <ul><ul><li>Within teams, new feature, hot fixes, etc. on branches. </li></ul></ul>
  15. 15. Mercurial Concepts: Features You'll Love <ul><ul><li>Go back in time -- almost instantly! </li></ul></ul><ul><ul><ul><li>hg update <changeset#> </li></ul></ul></ul><ul><ul><ul><li>To any changeset / branch. </li></ul></ul></ul><ul><ul><li>Renames tracked, can be auto-detected. </li></ul></ul><ul><ul><ul><li>hg addremove --similarity 80 </li></ul></ul></ul><ul><ul><li>Branching easy , merging easier: </li></ul></ul><ul><ul><ul><li>Implicit local branching. </li></ul></ul></ul><ul><ul><ul><li>Named branches:  </li></ul></ul></ul><ul><ul><ul><ul><li>hg branch myNamedBranch </li></ul></ul></ul></ul><ul><ul><ul><li>Parenting understood. </li></ul></ul></ul><ul><ul><ul><li>Automerge is better, safer. </li></ul></ul></ul><ul><ul><li>Cool stuff : </li></ul></ul><ul><ul><ul><li>bookmarks, multiple heads, backout, rollback, strip (for git lovers) </li></ul></ul></ul><ul><ul><ul><li>clone your clone, prune dead branches. </li></ul></ul></ul>
  16. 16. Mercurial: Q&A <ul><li>Silence = You Understood Everything  </li></ul><ul><li>                and Won't Ask Me Later. </li></ul>
  17. 17. Further Reading <ul><ul><li>Official docs: http://mercurial.selenic.com/learn/ </li></ul></ul><ul><ul><ul><li>PLEASE READ THE QUICK START : http://mercurial.selenic.com/quickstart/ </li></ul></ul></ul><ul><ul><li>If you like pretty pictures: http://hginit.com/ </li></ul></ul><ul><ul><li>If you like Python people: http://hgbook.red-bean.com/read/a-tour-of-mercurial-the-basics.html </li></ul></ul><ul><ul><li>If you like Joel Spoelsky: http://hginit.com/ </li></ul></ul><ul><ul><li>Visualizing branch models (Git but applies to Hg): http://nvie.com/posts/a-successful-git-branching-model/ </li></ul></ul><ul><ul><li>The Safari Definitive Guide's website (with the book online, with inline comments): http://hgbook.red-bean.com/ </li></ul></ul><ul><ul><ul><li>The implementation is interesting in order to understanding how to use Hg: http://hgbook.red-bean.com/read/behind-the-scenes.html </li></ul></ul></ul>
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×