Mercurial & TorToise-HG
What Mercurial is a revision control system (RCS) Revision control is the process of managing multiple versions of a piece of information Tortoise is a set of graphical tools for Mercurial
Why Enables collaboration of multiple developers on shared files Tracks changes in projects: who, why, when & what Identifies and resolves potentially incompatible changes Enables recovery from mistakes
How does it work?
Definitions Repository – contains all of the files that “belong to” a project, along with a historical record of the project's files Clone – a clone of a repository, enables synchronizing with the original repository Changeset – a record of changes to (potentially) several files
Actions Commit – records changes in a new changeset Push – sends changes to another repository Pull – gets changes from another repository Update – update the changes that were pulled
Push/Pull Model
How do we use it? We don’t change the source files in Public Instead, we have a revision control over shared libraries Matlab tooboxes Perl modules Each one of them is a Repository Each one of us has Clones of them We make changes locally and push them only after a code review with Liran
Cloning a repository Should be done on a location in the server (Z:\) Right click the directory in which you want to create the repository, then click TortoiseHG and Clone
Click the Browse button next to Source Path and choose the repository you would like to clone
Click Clone
Overlay icons Open the folder and you will see overlay icons which reflect the status of the files Green V – no uncommitted change Red exclamation mark - uncommitted change Question mark – state unknown To update the overlay icons right-click the clone repository and from the TortoiseHG menu choose “Update Icons”
Viewing changes Right click your repository/ a directory or file inside your repository click TortoiseHG and then Visual Diff Choose from the window the file to compare A Kdiff window will open
Commit 1st time use: make sure your commit username is correct Right click your repository and choose TortioseHG and then Global Settings
Click the Commit tab and enter your username. Click Close
2nd time and up: Right click your repository/ a directory or file inside your repository and click HG Commit
Commit process: The commit button Enter commit message here The files that changed Shows the changes in the selected file from the last revision Legend of file statuses
Check that the commit was successful and close the log and commit windows
Synchronizing with original repository Right click your repository and choose TortioseHG and then Synchronize
Outgoing Displays local changes that’d be pushed Files that changed between the repositories The description is our commit comment
Push Done after commit and after code review Number of changesets (revisions) that are being pushed and to how many files
Incoming Displays changes that can be pulled from selected repository Who made the change and when Files that changed between the repositories The description is the commit comment
Pull Pulls changes from selected repository Number of changesets (revisions) that are being pulled and to how many files Update the changes in your repository View the modifications
Repository Explorer Used to visualize the revision history of each file in your repository Right click your repository and choose TortioseHG and then HG Repository Explorer
Summary of the change (the commit comment) Summary of the change (the commit comment). Bold – the revision currently used in the repository The user who committed the change How long ago the revision was committed Synchronizing tools Graphic display of revisions The modified files in the selected revision The changes made in the selected file in the selected revision
For more information Mercurial book Tortoise book