Feb 2011 DVCS with Mercurial
Sep 14, 2014
Feb 2011
DVCS with Mercurial
Agenda What is DVCS? How does it work? Mercurial features Extensions Why not SVN? (SVN vs Mercurial) Questions
What is DVCS?
What is DVCS? DVCS - A distributed revision control,
distributed version control system (DVCS) keeps track of software revisions and allows many developers to work on a given project independent of network access or a central server. Committing, branching and merging are fast.
DVCS is…Distributed version control system (DVCS) takes a peer-to-peer approach, as opposed to the client-server approach of centralized systems. Rather than a single, central repository on which clients synchronize, each peer's working copy of the codebase is a bona-fide repository. Distributed version control conducts synchronization by exchanging patches (change-sets) from peer to peer
Currently in SVN
Currently in Mercurial
DVCS - Advantages Fast
Mercurials implementation and data structures are designed to be fast. You can generate diffs between revisions, or jump back in time within seconds.
Platform independentMercurial was written with platform independence in mind. Therefore most of Mercurial is written in Python, with a small part in portable C for performance reasons. As a result, binary releases are available on all major platforms.
ExtensibleThe functionality of Mercurial can be increased with extensions, either by activating the official ones which are shipped with Mercurial or downloading some from the wiki or by writing your own. Extensions are written in Python and can change the workings of the basic commands, add new commands and access all the core functions of Mercurial.
Open SourceMercurial is free software licensed under the terms of the GNU General Public License Version 2.
How does it work?or how it works with TortoiseHG
You have:
A working copy. The files you are currently editing. A repository. A directory (.hg in Mercurial) containing all patches and metadata (comments,
guids, dates, etc.). There’s no central server so the data stays with you.
How does it work? – Merge
How does it work? – Changesets! Like in Subversion, history consists of a number of
commits. They're called changesets in Mercurial. A changeset is an atomic collection of changes to files in
a repository. It contains all recorded local files modification and:
information about who made the change (the "committer"), why ("comments") and when (date/time, timezone)
the name of the branch ("default", if omitted or not set) A changeset is identified uniquely by a changeset ID
(1ef7872431f9c64908c732f0bcd4db5700b4cb70 ). In a single repository, you can identify it using a revision number.
How does it work? – Csets tree!
How does it work? – Csets tree!
How does it work? – Push to stable!
How does it work? – Push to stable!
How does it work? – Push to stable!
Mercurial featuresPushing changes to another repositoryMerging conflicting changesSearching through historyViewing repository through a web browserUsing Mercurial as a “super client” for
Subversion
Mercurial Features – Merge conflicts
Mercurial Features – Merge conflicts
Mercurial Features – web browser
How does it work? - basic commands Commit selected diffs in checked files. Undo (rollback) last immediate commit. Visual Diff checked files. Revert checked files to last revisioned state Add checked files Move checked files Remove checked files Forget checked files Pull all changes from another repository into the current
one Push all changes from your repository into another one Shelve changes when they not needed and get them
back in future
Extensions
Extensions - Enabling
Extensions - rebase
Extensions – Shelve
The shelve extension lets you to choose which parts of the changes in a working directory you'd like to set aside temporarily, at the granularity of patch hunks. You can later restore the shelved patch hunks using the unshelve command.
Extensions – more and more Purge – deletes all files and directories in the
repository that are not being tracked by Mercurial Notify – Send email to subscribed addresses to
notify repository changes Convert – convert repositories from other SCMs
into Mercurial Highlight – Highlight syntax in the file revision
view of hgweb Bisect – Quickly find the revision that introduces
a bug or feature bisecting the history tree …
Why not SVN?
SVN Limitations
Branching is easy, merging is easy
If your computer is on, you have access to the repository
Sharing changes withselected people is easy (hg serve/hg push/hg pull)
Aware of file history and can merge into renamed file Single .hg directory at root of
source tree Fast performance; you’re working
on local filesystem Cheap to create/throw away local
experimental branch
Branching is easy, but merging is painful
Active net connectionrequired to interact
Unable to share changeswith others without sharing with everyone (including the build server)
Fails to merge changes whensomething is renamed
.svn files are littered throughout your source tree
Slow over-the-wire performance
Discourages experimentation
DVCS/Mercurial Strengths
SVN Strengths DVCS/Mercurial limitations
Most developers will need to learn to think differently
Better understanding of version control concepts required
Need to define and adhere to convention to know where the trunk is
Familiar to most developers
Relatively easy to grasp
Everyone knows where the trunk is because there’s only one server
Projects using mercurial1. Mozilla2. OpenJDK3. OpenSolaris4. OpenOffice.org5. Symbian OS6. Adium7. Audacious8. Coin3D9. OSSEC10. CubicWeb11. Dovecot IMAP server12. GeeXboX13. RabbitMQ14. Go programming language15. GNU Octave16. GNU Multi-Precision Library
17. Growl18. LEMON19. LinuxTV/Video4Linux20. LuxRender 3D Render Engine21. Mercurial22. MoinMoin wiki software23. Mutt24. Netbeans25. Nuxeo26. Ogre3D27. SAGE28. Vim29. Lugaru HD30. Tryton31. Tuenti
Usefull links
Download Mercurial: http://mercurial.selenic.com/wiki/Download
Dvcs With Mercurial presentation: http://www.slideshare.net/tednaleid/dvcs-with-mercurial-no-notes
Migrating from and VCS: http://mercurial.selenic.com/wiki/RepositoryConversion
VS Plugin: http://visualhg.codeplex.com/ Mercurial as a “super client” for Subversion:
http://naleid.com/blog/2008/05/01/using-mercurial-as-a-super-client-for-subversion/
Questions?