Installing Mercurial

  • Revision slug: Installing_Mercurial
  • Revision title: Installing Mercurial
  • Revision id: 52494
  • Created:
  • Creator: Steffen
  • Is current revision? No
  • Comment Installing: hg is part of MozillaBuild

Revision Content

{{ Note("If you have not yet read the Mercurial basics do so now, or see Mercurial for other resources.") }}

Installing

On Windows:
Mercurial comes with MozillaBuild. See also {{ mediawiki.interwiki('wikimo', 'Mercurial_on_Windows', 'wikimo:Mercurial on Windows') }}.

Other systems:
If you use apt-get, emerge, port, yast, or yum to install software, just do the usual. If this gives you an old version (pre-1.0 -- check with hg version), you can update it using easy_install as follows (using apt-get in this example):
sudo apt-get install python-setuptools python-dev build-essential
sudo easy_install -U mercurial

Otherwise, the Mercurial binary packages are for you.

Merge program

After installing, choose a merge program. Seriously. Do it now. If you don't, Mercurial will choose one for you and spring it on you when you least expect it.

A reasonable thing to do is to set <tt>ui.merge=internal:merge</tt> in the Mercurial configuration file (see below), which makes Mercurial try to merge changes and add the conflict markers (a la CVS) to the files that couldn't be merged.

You can see the list of merge conflicts by looking for "merging ... failed!" in the update output.

Configuration

You should configure Mercurial before pulling the code. Your mercurial configuration file should have at least the following settings:

[ui]
username = Your Real Name <user@example.com>
merge = your-merge-program

[diff]
git = 1

[defaults]
diff=-p -U 8

On Windows, these settings can be added to <tt>C:\Program Files\Mercurial\Mercurial.ini</tt>. On UNIX-like systems, they should be in your <tt>$HOME/.hgrc</tt> file.

You can configure the editor to use for commit messages using the <tt>editor</tt> option in the <tt>{{ mediawiki.external('ui') }}</tt> section or by setting the <tt>EDITOR</tt> environment variable.

{{ languages( { "fr": "fr/Installation_de_Mercurial" } ) }}

Revision Source

<p>{{ Note("If you have not yet read the <a href='\"en/Mercurial_basics\"'>Mercurial basics</a> do so now, or see <a href='\"en/Mercurial\"'>Mercurial</a> for other resources.") }}
</p>
<h2 name="Installing"> Installing </h2>
<p></p><dl>
<dt>On Windows:
</dt><dd>Mercurial comes with <a href="en/Windows_Build_Prerequisites#MozillaBuild">MozillaBuild</a>.
See also {{ mediawiki.interwiki('wikimo', 'Mercurial_on_Windows', 'wikimo:Mercurial on Windows') }}.
<p></p></dd><dt>Other systems:
</dt><dd>If you use <code>apt-get</code>, <code>emerge</code>, <code>port</code>, <code>yast</code>, or <code>yum</code> to install software, just do the usual. If this gives you an old version (pre-1.0 -- check with <code>hg version</code>), you can update it using <code>easy_install</code> as follows (using <code>apt-get</code> in this example): <pre class="eval">sudo apt-get install python-setuptools python-dev build-essential
sudo easy_install -U mercurial
</pre>
<p>Otherwise, the <a class="external" href="http://www.selenic.com/mercurial/wiki/index.cgi/BinaryPackages">Mercurial binary packages</a> are for you.
</p></dd></dl> <h3 name="Merge_program"> Merge program </h3>
<p>After installing, <b>choose a <a class="external" href="http://www.selenic.com/mercurial/wiki/index.cgi/MergeProgram">merge program</a></b>. Seriously. Do it now. If you don't, Mercurial will choose one for you and spring it on you when you least expect it.
</p><p>A reasonable thing to do is to set <tt>ui.merge=internal:merge</tt> in the Mercurial configuration file (see below), which makes Mercurial try to merge changes and add the conflict markers (a la CVS) to the files that couldn't be merged.
</p><p>You can see the list of merge conflicts by looking for "merging ... failed!" in the update output.
</p>
<h3 name="Configuration"> Configuration </h3>
<p>You should configure Mercurial before pulling the code. Your mercurial configuration file should have at least the following settings:
</p>
<pre class="eval">[ui]
username = Your Real Name &lt;<a class=" link-mailto" href="mailto:user@example.com" rel="freelink">user@example.com</a>&gt;
merge = <i>your-merge-program</i>

[diff]
git = 1

[defaults]
diff=-p -U 8
</pre>
<p>On Windows, these settings can be added to <tt>C:\Program Files\Mercurial\Mercurial.ini</tt>. On UNIX-like systems, they should be in your <tt>$HOME/.hgrc</tt> file.
</p><p>You can configure the editor to use for commit messages using the <tt>editor</tt> option in the <tt>{{ mediawiki.external('ui') }}</tt> section or by setting the <tt>EDITOR</tt> environment variable.
</p>
<div class="noinclude">
</div>
{{ languages( { "fr": "fr/Installation_de_Mercurial" } ) }}
Revert to this revision