MDN’s new design is in Beta! A sneak peek:


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.


Installing and configuring Mercurial

See Installing Mercurial.

Checking out a source tree

There are multiple hg repositories hosted at, see 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 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.1 (Firefox 3.5)

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

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

cd 191src

comm-central (SeaMonkey 2/Calendar/Thunderbird 3)

"comm-central" is for SeaMonkey/Calendar/Thunderbird on Hg (TB3, SM2, and ? Sunbird/Lightning). By pulling comm-central you also get mozilla-central (or mozilla-1.9.1) as well as a few other repositories/directories (domi, chatzilla, to name a few) - this means you can also build Firefox with this combination checked out.

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

# Pull the Mozilla source to the folder commsrc/ - may take a while 
# as hundreds of megabytes of history is downloaded to .hg
hg clone commsrc

cd commsrc

python checkout


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 are not yet available on (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):

default =

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



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


# 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 build



 此页面的贡献者: ziyunfei, phenix
 最后编辑者: ziyunfei,