You’re reading the English version of this content since no translation exists yet for this locale. Help us translate this article!
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.
Selecting a repository (tree)
There are multiple hg repositories hosted at mozilla.org to choose from. A summary of the main trees is given below, but see https://hg.mozilla.org/ for the full list.
This is the main development tree for Firefox. Most developers write patches against mozilla-central.
This is the main integration tree for Firefox. Most developers also maintain a clone of this tree to land their patches. You probably want to develop on top of mozilla-central, which tends to be more stable, but you should land patches on mozilla-inbound once they are ready. See this page for how checking code into mozilla-inbound works.
The source for the current beta version of Firefox (and the next and all previous betas). This code represents the expected next release of the Firefox browser, and should be pretty stable.
The source for the current release of Firefox (and the next and all previous releases).
Mainly useful for localizers working on localizing Firefox. Code for all l10n projects lives here and is organized into separate repos that (in most cases) have the locale's two character ISO code. To get the repo that you need look for the repo you're interested in on the following page.
The Thunderbird/SeaMonkey/Calendar equivalent of mozilla-central. See Comm-central source code (Mercurial) for other "comms" trees and further instructions relating to these trees.
It is common for advanced users to want to interact with more than 1 firefox repository. If you get to the point where having individual copies of repositories is annoying you, then see https://mozilla-version-control-tools.readthedocs.org/en/latest/hgmozilla/unifiedrepo.html for instructions on doing this efficiently.
Cloning a repository
Getting a copy of one of the repositories listed above nowadays requires downloading in excess of 1 GB of data.
Using Mercurial bundles
If you are worried that your Internet connection is not fast or robust enough to download such a large amount of data all in one go without being interupted, then you are recommended to download one of the Mercurial bundles. If interupted, they can be resumed (continued without downloading from the beginning) if the app you're using to download supports it. For example, in Firefox you would right click on the download and select
Resume once your connection to the Internet was reestablished.
If you are not worried about network interuptions, then you can simply use Mercurial to directly clone the repository you're interested in using its URL, as given above. For example, to use the command line to clone
mozilla-central into a directory called
firefox-source, you would use the following:
hg clone https://hg.mozilla.org/mozilla-central/ firefox-source cd firefox-source
Selecting a revision to build
Most of the time the
tip revision of most repositories will build without issue. If you are worried about it not, then you may want to get the latest revision that has passed the automatic tests.
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.