Mercurial
Introduction

Mercurial is a Source Code Control system by Selenic, it's key feature is the distributed nature of the system.
This means that changes (commits) are stored in a local repository, which can be sent (pushed) to a central repository and which can be downloaded (pulled) by others.
Getting started
Joel Spolsky has written a How-To and Why-To page called HG init (hg is the chemical symbol for Mercury).
Configuration
Mercurial stores it's setting in a file called 'hgrc' inside a hidden folder '.hg'
Setting up LVMerge
LVMerge can be used by Mercurial as a Merge tool. Add the following text to the hgrc file:
[merge-tools] LVMerge.args = $base $other $local $output LVMerge.executable = C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe LVMerge.gui = True LVMerge.binary = True [merge-patterns] **.vi = LVMerge **.ctl = LVMerge **.lvclass = LVMerge **.xctl == LVMerge **.lvlib ==LVMerge
Ignoring files
Mercurial stores general ignore patterns in a file called '.hgignore' in the repository root, so you can add the patterns to the repository. I use the following patterns
.ogp$ /built*$ /build*$ .lvlps$ .aliases$
Performing a merge
The following conditions needs to be true to be able to perform a merge:
- All local changes needs to be commited (hg st should only show ?)
- A changeset is pushed by another user to the central repository
- The other changeset is not yet pulled
The merge will try to detect the differences and call LVMerge if necesarry, LVmerge will show four VIs:
- Base, the base VI which was present in the changeset that is the same on both repositories
- Mine, local commited VI
- Their, remote VI with edits from the other user
These are not editable.
- Resulting, this is the VI that will be stored to disc after the merge finalizes. This file can be edited by the user
For each diff LVMerge will give options to use either, 'base', 'mine' or 'their' code.
After the merge the code should be committed and pushed.
Most Mercurial Clients will show a graph with the following layout:
Mercurial clients
On Windows, Mac
and Linux
, there is a command line client called 'hg'. On windows there is a context menu tool called TortoiseHG based on the popular TortoiseSVN and TortoiseCVS tools
Further reading
- Official website
- HG Init
- Mercurial: The Definitive Guide
- Setting Up Mercurial with Apache
- Kiln / Mercurial Knowledge site