# Getting Mozilla Source Code Using Mercurial

Revision Information
• Revision slug: Developer_Guide/Source_Code/Mercurial
• Revision title: Getting Mozilla Source Code Using Mercurial
• Revision id: 18411
• Created:
• Creator: poke
• Is reviewed? Yes
• Reviewed:
• Reviewed by: Jay
• Is approved? Yes
• Is current revision? No
• Comment Fix links to Aurora and Beta repositories; one or more formatting 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.

### 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. This code is experimental and not considered ready for distribution.

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
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-aurora (second-stage development tree)

When patches are considered ready for broader testing, they get branched onto mozilla-aurora. This code, while more complete (and, in theory, stable) than mozilla-central, is not yet beta-quality. If you want to build off this branch, you can clone the repository as follows:

# Pull the Mozilla source to the folder aurora-src/ - may take a while
hg clone http://hg.mozilla.org/releases/mozilla-aurora/ aurora-src

cd aurora-src

#### 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
hg clone http://hg.mozilla.org/releases/mozilla-beta/ beta-src

cd beta-src



#### mozilla-release (release tree)

To get the source repository for the current release of Firefox, do the following:

hg clone http://hg.mozilla.org/releases/mozilla-release release-src
cd release-src


#### mozilla-2.0 (Firefox 4.0)

Code for the Firefox 4.0 (Gecko 2.0) release lives in releases/mozilla-2.0. To get this code, do the following:

# Pull the Mozilla source to the folder 20src/ - may take a while
hg clone http://hg.mozilla.org/releases/mozilla-2.0/ 20src

cd 20src

#### 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, do the following:

# Pull the Mozilla source to the folder 192src/ - may take a while
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, do the following:

# Pull the Mozilla source to the folder 191src/ - may take a while
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.

Note: If you want to contribute patches to Thunderbird 3.x or SeaMonkey 2.x development, see comm-central source code.

#### L10n repos

If you are creating a new localization beased 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
hg clone http://hg.mozilla.org/l10n-central/your-ISO-code yourISOcode

cd yourISOcode


### 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 some of the repositories listed at http://hg.mozilla.org/ are available on ftp.mozilla.org:

Bundles for some of the other repositories may also be found by googling. The 'hg pull' you will run later will verify the integrity of the bundle you download.

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

hg init src


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

To use the below command in windows, export the \path\to\hg and invoke the command from command prompt.

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

(The unbundle is gonna take quite a lot of time)

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.