1 / 39

Introduction to Distributed Version Control with Mercurial

Introduction to Distributed Version Control with Mercurial. John C. Zablocki Development Lead, Magazine Radar Engineering Lead, ImOK Philly Code Camp 2011.1 2011-04-09. Agenda. Distributed Version Control. It’s not just for kernel developers…. Distributed.

kaia
Télécharger la présentation

Introduction to Distributed Version Control with Mercurial

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Introduction to Distributed Version Control with Mercurial John C. Zablocki Development Lead, Magazine Radar Engineering Lead, ImOK Philly Code Camp 2011.1 2011-04-09

  2. Agenda

  3. Distributed Version Control It’s not just for kernel developers…

  4. Distributed

  5. There is no centralized repository • A centralized workflow is possible and common • Working copies are full repositories • Built in redundancy • Commits are made to local history first • Frequent commits without affecting other developers • Revision numbers are replaced by changesets • Better merging capabilities Distributed Version Control Basics

  6. Alice Repository Commit Bob Checkout Carl Commit Centralized Workflow

  7. Commit Alice Centralized Repository Push Push Bob Pull Pull Carl Distributed Workflow

  8. Clone Remote Repository Local History Modify Add Push Commit Basic Workflow - Push

  9. Local History Remote Repository Update Merge Pull Commit Basic Workflow - Pull

  10. Mercurial Basics http://mercurial.selenic.com/wiki/UnderstandingMercurial

  11. Maintained by Selenic • Sponsored by Microsoft, Google, Atlassian, FogCreek and many others • Open source and licensed under GPL • Written mostly in Python (2.4-2.7), with some portable C where necessary for performance • Binaries available for Windows, GNU/Linux, Mac OSX, Solaris 11 Express • It’s kind of awesome About Mercurial

  12. Repository – the .hg directory in the repository root • Working Directory – top-level directory in a repository • Changeset – atomic collection of changes to files • Revision – a distinct changeset in a repository • Head – a changeset with no child changesets • Tip – the most recently changed head Mercurial Glossary

  13. Collaborative

  14. Mercurial separates the act of committing new code from the act of inflicting it on everybody else. - Joel Spolsky

  15. .hg What’s in a Repository?

  16. Committing Changes

  17. Cset Head Tip Revisions, Changesets, Heads and Tip

  18. Bob clone’s Alice’s Repo Bob commits two changes (local) Cloning, making changes, merging, pulling and updating

  19. Alice commits one change locally Bob pulls Alice’s changes Bob merges Alice’s changes Cloning, making changes, merging, pulling and updating

  20. Bob commits to create a new changeset Cloning, making changes, merging, pulling and updating

  21. Alice pulls from Bob’s repository Alice’s updates her working directory Cloning, making changes, merging, pulling and updating

  22. A decentralized System

  23. Frequent commits without affecting others • Better Merging • Mercurial stores more information about changes • More efficient storage • Revisions contain only deltas of changed files • Faster checkouts (cloning) • Incremental snapshots • Redundancy • Every developer has a copy of the repository Mercurial Advantages

  24. Disambiguation • hg com == hg commit • Commit is on entire directory • Not ideal for partial checkout scenarios • Empty directories are not tracked • Add EMPTY file Mercurial Concepts

  25. Mercurial.ini or .hgrc • Global configuration • Username • [ui]username = johnzablocki • Auth • [web]push_ssl= falseallow_push= * • Extensions • [extensions]hgsubversion= path/to/extensionhgexternals= path/to/extensionmercurial_keyring= • Hooks • .hg/hgrc • Repository specific version of Mercurial.ini • Not cloned • .hgignore • Include in working directory root to set ignore patterns for all commits • #-- Directoriesbin/BIN/ Mercurial Configuration

  26. Mercurial Basics

  27. Mercurial Basics

  28. Mercurial Basics

  29. Mercurial Extensions Nothing to compile…

  30. Mongo Philly Discount Code PCC

  31. ACL Extension • Allows fine grained access control over parts of a repository using deny and allow lists • Keyring Extension • Securely save HTTP passwords in OS keyring Security Extensions

  32. hgsubversion • Use Mercurial as an SVN client • tfs • Update Team Foundation Server work items • hg-git • Push and pull from a Git server • cvscommit – Push changesets to CVS Interoperability Extensions

  33. hgexternals – Pull external repositories into a Mercurial repository • fetch – Pull, merge and update in one step • purge – Purge all untracked files in a repository Other Useful Extensions

  34. Mercurial on Windows Yes, there’s a Tortoise…

  35. Yet another shell extension to add to your context menu in Explorer! • Contains useful Python extensions TortoiseHg

  36. Non-trivial • CGI -http://www.jeremyskinner.co.uk/mercurial-on-iis7/ • WSGI - http://www.eworldui.net/blog/post/2010/04/08/Setting-up-Mercurial-server-in-IIS7-using-a-ISAPI-module.aspx Running Hg on IIS

  37. DVCS Flavors and OSS Hosting

  38. http://dllHell.net - my blog • http://www.CodeVoyeur.com- my code • http://www.linkedin.com/in/johnzablocki • http://twitter.com/codevoyeur • http://mercurial.selenic.com- Mercurial site • http://bitbucket.org • http://about.me/johnzablocki Links

  39. Questions?

More Related