Getting Mozilla Source Code Using Mercurial

  • Revision slug: Developer_Guide/Source_Code/Mercurial
  • Revision title: Getting Mozilla Source Code Using Mercurial
  • Revision id: 18395
  • Created:
  • Creator: slavomir.kuzma
  • Is current revision? No
  • Comment no changes

Revision Content

Mercurial is a source-code management tool which allows users to keep track of changes to the source code locally and share their changes with others. It is used for the development of Firefox 3.5/Mozilla 1.9.1 and later releases.

Note: If you want to contribute patches to Thunderbird 3.x or SeaMonkey 2.x development, use Comm-central source code.  If you want to contribute patches to Firefox 3.0.x, Thunderbird 2.0.x or SeaMonkey 1.1.x development, use CVS source code.

Client settings

Installing and configuring Mercurial

See Installing Mercurial.

Checking out a source tree

There are multiple hg repositories hosted at mozilla.org, see http://hg.mozilla.org/ for the full list.

mozilla-central (main development tree)

Code for future releases lives in mozilla-central.

To get the code for mozilla-central with the latest committed changes "clone" the repository (Mercurial terminology):

# Pull the Mozilla source to the folder src/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone http://hg.mozilla.org/mozilla-central/ src

cd src

mozilla-central (latest successful build)

The latest committed changes may not build successfully. You may want to get the source code that has passed the automatic tests.

mozilla-1.9.2 (Firefox 3.6)

Code for the Firefox 3.6 (Gecko 1.9.2) release lives in releases/mozilla-1.9.2. To get this code:

# Pull the Mozilla source to the folder 192src/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/ 192src

cd 192src

mozilla-1.9.1 (Firefox 3.5)

Code for the Firefox 3.5 (Gecko 1.9.1) release lives in releases/mozilla-1.9.1. To get this code:

# Pull the Mozilla source to the folder 191src/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone http://hg.mozilla.org/releases/mozilla-1.9.1/ 191src

cd 191src

comm-central (Thunderbird/SeaMonkey/Calendar)

See Comm-central source code (Mercurial) for further information on pulling and building with comm-central.

Bundles

If you have a poor network connection that is preventing 'hg clone' from completing, you may want to try downloading a bundle of the repository you're interested in (which, unlike 'hg clone', can be resumed when network problems interrupt the download).

Up to date bundles of the repositories listed at http://hg.mozilla.org/ are not yet available on mozilla.org (bug 437482 has been filed for that). However, bundles for some of the repositories listed can be found by googling. For example, here is a mozilla-central bundle and here is a comm-central bundle.

Once you have downloaded the repository bundle, follow these steps:

1. Initialize a new repository (in a directory called 'src' here):

hg init src

2. Un-bundle the bundle file to that repository:

cd src
hg unbundle /path/to/your/repository.bundle

3. Add the following lines to the file src/.hg/hgrc (you may have to create it) so that hg will automatically know where to pull changes from in future (replacing 'mozilla-central' as appropriate):

[paths]
default = http://hg.mozilla.org/mozilla-central/

4. Update the repository to get all the changes since the bundle was created (this step also doubles as a check of the bundle integrity since if its contents are not exactly the same as what's in the official repository then the 'hg pull' will fail):

hg pull

5. Check out a working copy from your new up to date repository:

hg up

 

Building

Configure and build as usual using a .mozconfig file and make -f client.mk.

Linux_Build_Prerequisites 

# Generate a mozconfig yourself, or use this minimal default one
echo '. $topsrcdir/browser/config/mozconfig' > .mozconfig

# configure will be automatically generated using the 'autoconf-2.13'
# command, except on OS X where autoconf213 will be used.
# If autoconf-2.13 isn't the right name for your system, as
# is the case on Ubuntu Linux, use the real command name as
# demonstrated below.
echo 'mk_add_options AUTOCONF=autoconf2.13' >> .mozconfig

# Now do the build; configure will be run automatically
make -f client.mk build

See also

  • The Mercurial page has information about creating diffs, committing changes, and publishing shared repositories.

{{ languages( { "es": "es/C\u00f3digo_fuente_de_Mozilla_(Mercurial)", "fr": "fr/Code_source_de_Mozilla_(Mercurial)", "ja": "ja/Mozilla_Source_Code_(Mercurial)", "pl": "pl/Kod_\u017ar\u00f3d\u0142owy_Mozilli_(Mercurial)", "zh-cn": "cn/%E9%80%9A%E8%BF%87Mercurial%E8%8E%B7%E5%8F%96%E6%BA%90%E7%A0%81"} ) }}

Revision Source

<p><a href="/en/Mercurial" title="en/Mercurial">Mercurial</a> is a source-code management tool which allows users to keep track of changes to the source code locally and share their changes with others. It is used for the development of Firefox 3.5/Mozilla 1.9.1 and later releases.</p>
<div class="note"><strong>Note:</strong> If you want to contribute patches to Thunderbird 3.x or SeaMonkey 2.x development, use <a class="internal" href="/En/Developer_Guide/Source_Code/Getting_comm-central" title="En/Comm-central source code (Mercurial)">Comm-central source code</a>.  If you want to contribute patches to Firefox 3.0.x, <span class="lang lang-en">Thunderbird 2.0.x or SeaMonkey 1.1.x</span> development, use <a class="internal" href="/En/Developer_Guide/Source_Code/CVS" title="En/Mozilla Source Code (CVS)">CVS source code</a>.</div>
<h3 name="Client_settings">Client settings</h3>
<h4 name="Installing_and_configuring_Mercurial">Installing and configuring Mercurial</h4>
<p>See <a href="/en/Installing_Mercurial" title="en/Installing_Mercurial">Installing Mercurial</a>.</p>
<h3 name="Checking_out_a_source_tree">Checking out a source tree</h3>
<p>There are multiple hg repositories hosted at mozilla.org, see <a class="external" href="http://hg.mozilla.org/" title="http://hg.mozilla.org/">http://hg.mozilla.org/</a> for the full list.</p>
<h4>mozilla-central (main development tree)</h4>
<p>Code for future releases lives in <a class="external" href="http://hg.mozilla.org/mozilla-central" title="http://hg.mozilla.org/mozilla-central"><code>mozilla-central</code></a>.</p>
<p>To get the code for mozilla-central with the latest committed changes "clone" the repository (Mercurial terminology):</p>
<pre># Pull the Mozilla source to the folder src/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone http://hg.mozilla.org/mozilla-central/ src

cd src</pre><h4>mozilla-central (latest successful build)</h4>
<p>The latest committed changes may not build successfully. You may want to <a class="external" href="/En/Developer_Guide/Source_Code/LatestPassingSource" title="https://developer.mozilla.org/En/Developer_Guide/Source_Code/LatestPassingSource">get the source code that has passed the automatic tests</a>.</p>
<h4 class="editable">mozilla-1.9.2 (Firefox 3.6)</h4>
<p>Code for the Firefox 3.6 (Gecko 1.9.2) release lives in <a class="external" href="http://hg.mozilla.org/releases/mozilla-1.9.2" title="http://hg.mozilla.org/releases/mozilla-1.9.2">releases/mozilla-1.9.2</a>. To get this code:</p>
<pre># Pull the Mozilla source to the folder 192src/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone http://hg.mozilla.org/releases/mozilla-1.9.2/ 192src

cd 192src</pre>
<h4>mozilla-1.9.1 (Firefox 3.5)</h4>
<p>Code for the Firefox 3.5 (Gecko 1.9.1) release lives in <a class="external" href="http://hg.mozilla.org/releases/mozilla-1.9.1" title="http://hg.mozilla.org/releases/mozilla-1.9.1">releases/mozilla-1.9.1</a>. To get this code:</p>
<pre># Pull the Mozilla source to the folder 191src/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone http://hg.mozilla.org/releases/mozilla-1.9.1/ 191src

cd 191src
</pre>
<h4>comm-central (Thunderbird/SeaMonkey/Calendar)</h4>
<p>See <a class="internal" href="/En/Developer_Guide/Source_Code/Getting_comm-central" title="En/Comm-central source code (Mercurial)">Comm-central source code (Mercurial)</a> for further information on pulling and building with <code>comm-central</code>.</p><h3 name="Building">Bundles</h3>
<p>If you have a poor network connection that is preventing 'hg clone' from completing, you may want to try downloading a bundle of the repository you're interested in (which, unlike 'hg clone', can be resumed when network problems interrupt the download).</p>
<p>Up to date bundles of the repositories listed at <a class="external" href="http://hg.mozilla.org/" title="http://hg.mozilla.org/">http://hg.mozilla.org/</a> are not yet available on mozilla.org (<a class="link-https" href="https://bugzilla.mozilla.org/show_bug.cgi?id=437482" title="https://bugzilla.mozilla.org/show_bug.cgi?id=437482">bug 437482</a> has been filed for that). However, bundles for some of the repositories listed can be found by googling. For example, <a class="external" href="http://benjamin.smedbergs.us/blog/2008-06-05/getting-mozilla-central-with-limited-bandwidth/" title="http://benjamin.smedbergs.us/blog/2008-06-05/getting-mozilla-central-with-limited-bandwidth/">here is a mozilla-central bundle</a> and <a class="external" href="http://www.rumblingedge.com/files/hg-bundles/" title="http://www.rumblingedge.com/files/hg-bundles/">here is a comm-central bundle</a>.</p>
<p>Once you have downloaded the repository bundle, follow these steps:</p>
<p>1. Initialize a new repository (in a directory called 'src' here):</p>
<pre>hg init src
</pre>
<p>2. Un-bundle the bundle file to that repository:</p>
<pre>cd src
hg unbundle /path/to/your/repository.bundle</pre>
<p>3. Add the following lines to the file <code>src/.hg/hgrc</code> (you may have to create it) so that hg will automatically know where to pull changes from in future (replacing 'mozilla-central' as appropriate):</p>
<pre>[paths]
default = http://hg.mozilla.org/mozilla-central/</pre>
<p>4. Update the repository to get all the changes since the bundle was created (this step also doubles as a check of the bundle integrity since if its contents are not exactly the same as what's in the official repository then the 'hg pull' will fail):</p>
<pre>hg pull</pre>
<p>5. Check out a working copy from your new up to date repository:</p>
<pre>hg up</pre>
<p> </p>
<h3 name="Building">Building</h3>
<p><a href="/en/Configuring_Build_Options" title="en/Configuring_Build_Options">Configure</a> and build as usual using a <code>.mozconfig</code> file and <code>make -f client.mk</code>.</p>
<p><a class="internal" href="/En/Developer_Guide/Build_Instructions/Linux_Prerequisites" title="En/Linux Build Prerequisites"><span style="text-decoration: underline;">Linux_Build_Prerequisites</span></a> </p>
<pre class="eval"># Generate a mozconfig yourself, or use this minimal default one
echo '. $topsrcdir/browser/config/mozconfig' &gt; .mozconfig

# configure will be automatically generated using the 'autoconf-2.13'
# command, except on OS X where autoconf213 will be used.
# If autoconf-2.13 isn't the right name for your system, as
# is the case on Ubuntu Linux, use the real command name as
# demonstrated below.
echo 'mk_add_options AUTOCONF=autoconf2.13' &gt;&gt; .mozconfig

# Now do the build; configure will be run automatically
make -f client.mk build
</pre>
<h3 name="See_also">See also</h3>
<ul> <li>The <a href="/en/Mercurial" title="en/Mercurial">Mercurial</a> page has information about creating diffs, committing changes, and publishing shared repositories.</li>
</ul>
<p>{{ languages( { "es": "es/C\u00f3digo_fuente_de_Mozilla_(Mercurial)", "fr": "fr/Code_source_de_Mozilla_(Mercurial)", "ja": "ja/Mozilla_Source_Code_(Mercurial)", "pl": "pl/Kod_\u017ar\u00f3d\u0142owy_Mozilli_(Mercurial)", "zh-cn": "cn/%E9%80%9A%E8%BF%87Mercurial%E8%8E%B7%E5%8F%96%E6%BA%90%E7%A0%81"} ) }}</p>
Revert to this revision