Mercurial: Difference between revisions
New page: = Introduction<br> = Mercurial is a Source Code Control system by Selenic, it's key feature is the distributed nature of the system.<br> This means that changes (... |
No edit summary |
||
| Line 1: | Line 1: | ||
= Introduction<br> = | = Introduction<br> = | ||
[[Image:Logo.Mercurial.png|left]]{{TOCright}}<br> | |||
Mercurial is a [[Source Code Control|Source Code Control]] system by Selenic, it's key feature is the distributed nature of the system.<br> | |||
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.<br> | |||
= Getting started<br> = | |||
Joel Spolsky has written a How-To and Why-To page called [[Www.hginit.com|HG init]] (hg is the chemical symbol for Mercury).<br> | |||
= Configuration<br> = | |||
Mercurial stores it's setting in a file called 'hgrc' inside a hidden folder '.hg'<br> | |||
[http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/configmerge_thirdparty/ LVMerge] can be used by Mercurial as a Merge tool. Add the following text to the hgrc file:<br> | == Setting up LVMerge<br> == | ||
[http://zone.ni.com/reference/en-XX/help/371361F-01/lvhowto/configmerge_thirdparty/ LVMerge] can be used by Mercurial as a Merge tool. Add the following text to the hgrc file:<br> | |||
<pre>[merge-tools] | <pre>[merge-tools] | ||
LVMerge.args = $base $other $local $output | LVMerge.args = $base $other $local $output | ||
LVMerge.executable = C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe | LVMerge.executable = C:\Program Files\National Instruments\Shared\LabVIEW Merge\LVMerge.exe | ||
LVMerge.gui = True | LVMerge.gui = True | ||
LVMerge.binary = True | LVMerge.binary = True | ||
| Line 27: | Line 29: | ||
**.xctl == LVMerge | **.xctl == LVMerge | ||
**.lvlib ==LVMerge | **.lvlib ==LVMerge | ||
</pre> | </pre> | ||
== Ignoring files<br> == | == Ignoring files<br> == | ||
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<br> | 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<br> | ||
<pre>.ogp$ | <pre>.ogp$ | ||
/built*$ | /built*$ | ||
| Line 36: | Line 38: | ||
.lvlps$ | .lvlps$ | ||
.aliases$ | .aliases$ | ||
</pre> | </pre> | ||
= Performing a merge<br> = | = Performing a merge<br> = | ||
The following conditions needs to be true to be able to perform a merge:<br> | The following conditions needs to be true to be able to perform a merge:<br> | ||
*All local changes needs to be commited (hg st should only show ?)<br> | *All local changes needs to be commited (hg st should only show ?)<br> | ||
*A changeset is pushed by another user to the central repository<br> | *A changeset is pushed by another user to the central repository<br> | ||
*The other changeset is not yet pulled<br> | *The other changeset is not yet pulled<br> | ||
The merge will try to detect the differences and call LVMerge if necesarry, LVmerge will show four VIs:<br> | The merge will try to detect the differences and call LVMerge if necesarry, LVmerge will show four VIs:<br> | ||
*Base, the base VI which was present in the changeset that is the same on both repositories<br> | *Base, the base VI which was present in the changeset that is the same on both repositories<br> | ||
*Mine, local commited VI<br> | *Mine, local commited VI<br> | ||
*Their, remote VI with edits from the other user<br> | *Their, remote VI with edits from the other user<br> | ||
These are not editable.<br> | These are not editable.<br> | ||
*Resulting, this is the VI that will be stored to disc after the merge finalizes. This file can be edited by the user<br> | *Resulting, this is the VI that will be stored to disc after the merge finalizes. This file can be edited by the user<br> | ||
For each diff LVMerge will give options to use either, 'base', 'mine' or 'their' code.<br> | For each diff LVMerge will give options to use either, 'base', 'mine' or 'their' code.<br> | ||
<br> | <br> | ||
After the merge the code should be committed and pushed.<br> | |||
Most Mercurial Clients will show a graph with the following layout:<br> | |||
[[Image:MergeTrackHG.png|border]]<br> | |||
= Mercurial clients = | |||
[[Image: | On Windows[[Image:Logo.Windows.png]], Mac[[Image:Logo.Mac.png]] and Linux [[Image:Logo.Linux.png]], there is a command line client called 'hg'. On windows there is a context menu tool called [http://tortoisehg.bitbucket.org TortoiseHG] based on the popular TortoiseSVN and TortoiseCVS tools | ||
= | = Further reading = | ||
*[http://mercurial.selenic.com Official website]<br> | |||
*[http://www.hginit.com HG Init]<br> | |||
*[http://hgbook.red-bean.com/ Mercurial: The Definitive Guide]<br> | |||
*[http://redline6561.livejournal.com/362393.html Setting Up Mercurial with Apache]<br> | |||
*[http://kiln.stackexchange.com Kiln / Mercurial Knowledge site]<br> | |||
<br> | |||
<br> | <br> | ||
[[Category:SCC]] | |||
Revision as of 12:42, 27 March 2010
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
