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.
Installing and configuring Mercurial
See Installing Mercurial.
Checking out a source tree
There are multiple hg repositories hosted at mozilla.org. See https://hg.mozilla.org/ for the full list.
mozilla-central (main development tree)
Most developers write patches against the mozilla-central tree.
Clone mozilla-central to get a local copy of the repository and then cd into it:
# This may take a while... hg clone https://hg.mozilla.org/mozilla-central/ firefox cd firefox
Latest successful build
The latest committed changes in your checkout may not build successfully. You may want to get the source code that has passed the automatic tests.
mozilla-inbound (used for landing your patches)
Most developers also maintain a clone of mozilla-inbound, which they use for landing their patches. You probably want to develop on top of mozilla-central, which tends to be more stable, but you should use mozilla-inbound when your patches are ready to land. See this page for how checking code into mozilla-inbound works.
hg clone https://hg.mozilla.org/integration/mozilla-inbound/ inbound cd inbound
mozilla-beta (prerelease development tree)
When a new release of Firefox enters beta testing, the code is branched into
mozilla-beta. This code represents the expected next release of the Firefox browser, and should be pretty stable. If you want to build off this branch, you can clone the repository as follows:
# Pull the Mozilla source to the folder beta-src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.org/releases/mozilla-beta/ beta cd beta
mozilla-release (release tree)
To get the source repository for the current release of Firefox, do the following:
hg clone https://hg.mozilla.org/releases/mozilla-release release cd release
See Comm-central source code (Mercurial) for further information on pulling and building with
If you are creating a new localization based on an already-localized version of a Mozilla project, you will be interested in cloning this code. Code for all l10n projects lives in l10n-central and is organized (in most cases) by the locale's two character ISO code. When cloning, use the same ISO code to name the local directory that will store it. To get this code, do the following:
# Pull the Mozilla source to the folder src/ - may take a while # as hundreds of megabytes of history is downloaded to .hg hg clone https://hg.mozilla.org/l10n-central/your-ISO-code yourISOcode cd yourISOcode
See Mercurial bundles for information about downloading a single large file instead of using "hg clone".
Using a Unified Repository
There are multiple repositories for Firefox. It is common to want to interact with more than 1 of them. See https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/unifiedrepo.html for instructions on doing this efficiently.
By default with no configuration a similar-to-release build is done. If you wish you can configure the build using a
.mozconfig file and
make -f client.mk. Different OSs have different prerequisites for a successful build, please refer to the build documentation to verify they are available on your build machine.