Localizing with Mercurial

  • Revision slug: Localizing_with_Mercurial
  • Revision title: Localizing with Mercurial
  • Revision id: 18506
  • Created:
  • Creator: AxelHecht
  • Is current revision? No
  • Comment 53 words added

Revision Content

{{ Fx_minversion_header("3") }} Localizing Firefox 3.1, SeaMonkey 2.0 and Thunderbird 3.0 includes dealing with Mercurial. The documentation is incomplete, if you have questions, please drop by #l10n or #hg on irc.mozilla.org, or ask in the Discussion page on this article.

There are various documents on dealing with Mercurial on MDC, which are tagged with "Mercurial". In particular, the Mercurial FAQ are worth a read. For the eager and quick, here are a few commands to get you en-US, a locale repo, and a .mozconfig that should enable you to create language packs and builds.

Tools

There are a few tools to interface with Mercurial. Starting of course with the command line client, but for those of you that prefer GUI tools, there'd be TortoiseHg for Windows, and there's Mercurial Eclipse for the fans of that cross platform environment.

Repositories

There are two repositories that contain en-US files:

  • mozilla-central contains the files for Firefox.
  • comm-central contains the files for SeaMonkey and Thunderbird which are not already part of Firefox.

{{ Note("When you get the comm-central repository, this will include the mozilla-central repository as well. You can therefore use the one set up for developing Firefox, SeaMonkey and Thunderbird without having to pull mozilla-central a second time.") }}

Pulling en-US for the first time

There are some updates on partial pulls, but for now, you'll have to pull mozilla-central or comm-central.

Firefox only

If you are only working on Firefox use:

hg clone http://hg.mozilla.org/mozilla-central/

This will create a clone of the mozilla-central repository in the directory mozilla-central.

Any of Firefox, SeaMonkey, Thunderbird

If you are working on any of Firefox, SeaMonkey, Thunderbird use:

hg clone http://hg.mozilla.org/comm-central/
cd comm-central
python client.py checkout

The first command will create a clone of the comm-central repository in the directory comm-central. The second command will move you into that directory.

The third command will do a clone of mozilla-central, and pull some cvs directories. The cvs directories are required for SeaMonkey and Thunderbird, some of these are old code that SeaMonkey and Thunderbird are moving away from, and some are extensions that have not moved to Mercurial yet.

Updating en-US

To update your mozilla-central working copy, go to your mozilla-central dir and

hg pull -u

This will both get new changesets from mozilla-central and apply those changes in your working copy.

To update your comm-central working copy, go to your comm-central dir and

python client.py checkout

This will both get new changesets from comm-central, mozilla-central and the other appropriate locations and apply those changes in your working copy.

Pull your locale

All locales are in one mxr, . The repositories are separate, though, you get a list of the repos at . To clone your localization, please use (in this case "de" is the locale code, replace as needed)

hg clone http://hg.mozilla.org/l10n-central/de/

or update with

hg pull -u

Sending your changes to mozilla

With mercurial you work in your own repository. Before committing your work you should ensure that there are no changes made to the remote repository, to do this, pull your locale, as per the section above.

After finishing a change or set of changes and checking you have updated to the latest, you should commit:

hg commit -m "message identifying the change (bug 555)"

Unlike CVS this won't send your changes to Mozilla's repository. First you need to push the changes. To push to l10n-central and other mozilla-hosted repositories you have to have committer access, and you must edit the file (your-local-hg-root)/.hg/hgrc (note, this is NOT your ~/.hgrc) to add this line (replacing email@host with your username at mozilla):

[paths]
default = http://hg.mozilla.org/l10n-central/ab-CD
default-push = ssh://hg.mozilla.org/l10n-central/ab-CD

You'll need to tell ssh which account to use for your pushes, too, by editing ~/.ssh/config and adding the lines

Host hg.mozilla.org
User user@host.domain

user@domain is your account, with a real @ instead of the % that you used for CVS. Afterwards you can push your work to the repository (and check the result on the dashboard)

hg push

A .mozconfig

Firefox via mozilla-central

If you followed the steps above to get just mozilla-central, your directory layout would look like

mozilla-central
+ browser
de
+ browser

and a .mozconfig would look like

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../fx-de
ac_add_options --with-l10n-base=..
ac_add_options --disable-compile-environment
ac_add_options --enable-application=browser

Firefox via comm-central

If you followed the steps above to get comm-central, your directory layout would look like

comm-central
+ mozilla
  + browser
de
+ browser

and a .mozconfig would look like

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../../fx-de
ac_add_options --with-l10n-base=..
ac_add_options --disable-compile-environment
ac_add_options --enable-application=browser

{{ Note("The make -f client.mk configure command must be run from the comm-central/mozilla directory.") }}

The --with-l10n-base line is correct with just "..". This is due to the way the environment works within comm-central.

Thunderbird and SeaMonkey

If you followed the steps above to get comm-central, your directory layout would look like

comm-central
+ mail
+ suite
de
+ mail
+ suite

and a .mozconfig for Thunderbird would look like

mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../tb-de
ac_add_options --with-l10n-base=..
ac_add_options --disable-compile-environment
ac_add_options --enable-application=mail

Replace tb-de with sm-de and mail with suite for a SeaMonkey .mozconfig.

Run the make -f client.mk configure command from the comm-central directory.

Compare-locales

Compare-locales works like it did, for Firefox:

compare-locales mozilla-central/browser/locales/l10n.ini . de

or for Thunderbird:

compare-locales comm-central/mail/locales/l10n.ini . de

Replace mail with suite if you want to check SeaMonkey.

{{ Note("This command may not work correctly for Thunderbird and SeaMonkey, this is in the process of being fixed") }}

Building langpacks etc

There's a small change here, you have to add --with-l10n-base as a configure argument, pointing to the base dir of your l10n repo. Follow Creating a Language Pack, adjust the paths as needed.

{{ languages( { "es": "es/L10n_en_Mercurial", "fr": "fr/Localisation_avec_Mercurial" } ) }}

Revision Source

<p>{{ Fx_minversion_header("3") }} Localizing Firefox 3.1, SeaMonkey 2.0 and Thunderbird 3.0 includes dealing with Mercurial. The documentation is incomplete, if you have questions, please drop by #l10n or #hg on irc.mozilla.org, or ask in the Discussion page on this article.</p>
<p>There are various documents on dealing with Mercurial on MDC, which are <a class="external" href="/Special:Tags" title="special:Tags?tag=Mercurial&amp;language=en">tagged with "Mercurial"</a>. In particular, the <a class="internal" href="/en/Mercurial_FAQ" title="En/Mercurial FAQ">Mercurial FAQ</a> are worth a read. For the eager and quick, here are a few commands to get you en-US, a locale repo, and a <code>.mozconfig</code> that should enable you to create language packs and builds.</p>
<h3>Tools</h3>
<p>There are a few tools to interface with Mercurial. Starting of course with the command line client, but for those of you that prefer GUI tools, there'd be <a class="external" href="http://tortoisehg.sourceforge.net/" title="http://tortoisehg.sourceforge.net/">TortoiseHg</a> for Windows, and there's <a class="external" href="http://trac-hg.assembla.com/mercurialeclipse" title="http://trac-hg.assembla.com/mercurialeclipse">Mercurial Eclipse</a> for the fans of that cross platform environment.</p>
<h3>Repositories</h3>
<p>There are two repositories that contain en-US files:</p>
<ul> <li><a class="internal" href="/en/mozilla-central" title="En/Mozilla-central">mozilla-central</a> contains the files for Firefox.</li> <li><a class="internal" href="/en/comm-central" title="En/Comm-central">comm-central</a> contains the files for SeaMonkey and Thunderbird which are not already part of Firefox.</li>
</ul>
<p>{{ Note("When you get the comm-central repository, this will include the mozilla-central repository as well. You can therefore use the one set up for developing Firefox, SeaMonkey and Thunderbird without having to pull mozilla-central a second time.") }}</p>
<h3 name="Pulling_en-US">Pulling en-US for the first time</h3>
<p>There are some updates on partial pulls, but for now, you'll have to pull mozilla-central or comm-central.</p>
<h4>Firefox only</h4>
<p>If you are only working on Firefox use:</p>
<pre class="eval">hg clone <a class=" external" href="http://hg.mozilla.org/mozilla-central/" rel="freelink">http://hg.mozilla.org/mozilla-central/</a>
</pre>
<p>This will create a clone of the mozilla-central repository in the directory mozilla-central.</p>
<h4>Any of Firefox, SeaMonkey, Thunderbird</h4>
<p>If you are working on any of Firefox, SeaMonkey, Thunderbird use:</p>
<pre>hg clone http://hg.mozilla.org/comm-central/
cd comm-central
python client.py checkout
</pre>
<p>The first command will create a clone of the comm-central repository in the directory comm-central. The second command will move you into that directory.</p>
<p>The third command will do a clone of mozilla-central, and pull some cvs directories. The cvs directories are required for SeaMonkey and Thunderbird, some of these are old code that SeaMonkey and Thunderbird are moving away from, and some are extensions that have not moved to Mercurial yet.</p>
<h3>Updating en-US</h3>
<p>To update your mozilla-central working copy, go to your mozilla-central dir and</p>
<pre class="eval">hg pull -u
</pre>
<p>This will both get new changesets from mozilla-central and apply those changes in your working copy.</p>
<p>To update your comm-central working copy, go to your comm-central dir and</p>
<pre>python client.py checkout</pre>
<p>This will both get new changesets from comm-central, mozilla-central and the other appropriate locations and apply those changes in your working copy.</p>
<h3 name="Pull_your_locale">Pull your locale</h3>
<p>All locales are in one mxr, <a class="external" href="http://mxr.mozilla.org/l10n-central/"></a>. The repositories are separate, though, you get a list of the repos at <a class="external" href="http://hg.mozilla.org/l10n-central/"></a>. To clone your localization, please use (in this case "de" is the locale code, replace as needed)</p>
<pre class="eval">hg clone <a class=" external" href="http://hg.mozilla.org/l10n-central/de/" rel="freelink">http://hg.mozilla.org/l10n-central/de/</a>
</pre>
<p>or update with</p>
<pre>hg pull -u
</pre>
<h3>Sending your changes to mozilla</h3>
<p>With mercurial you work in your own repository. Before committing your work you should ensure that there are no changes made to the remote repository, to do this, pull your locale, as per the section above.</p>
<p>After finishing a change or set of changes and checking you have updated to the latest, you should commit:</p>
<pre class="eval">hg commit -m "message identifying the change (bug 555)"
</pre>
<p>Unlike CVS this won't send your changes to Mozilla's repository. First you need to push the changes. To push to <a class="external" href="http://hg.mozilla.org/l10n-central/" title="http://hg.mozilla.org/l10n-central/">l10n-central</a> and other mozilla-hosted repositories you have to have committer access, and you must edit the file <code><em>(your-local-hg-root)</em>/.hg/hgrc</code> (note, this is <strong>NOT</strong> your <code>~/.hgrc</code>) to add this line (replacing email@host with your username at mozilla):</p>
<pre class="eval">[paths]
default = <a class=" external" href="http://hg.mozilla.org/l10n-central/ab-CD" rel="freelink">http://hg.mozilla.org/l10n-central/ab-CD</a>
<strong>default-push = <a class=" external" href="ssh://hg.mozilla.org/l10n-central/ab-CD" rel="freelink">ssh://hg.mozilla.org/l10n-central/ab-CD</a></strong></pre>
<p>You'll need to tell ssh which account to use for your pushes, too, by editing <code>~/.ssh/config</code> and adding the lines</p>
<pre>Host hg.mozilla.org
User user@host.domain
</pre>
<p><code>user@domain</code> is your account, with a real @ instead of the % that you used for CVS. Afterwards you can push your work to the repository (and check the result on the dashboard)</p>
<pre class="eval">hg push</pre>
<h3 name="A_.mozconfig">A .mozconfig</h3>
<h4>Firefox via mozilla-central</h4>
<p>If you followed the steps above to get just mozilla-central, your directory layout would look like</p>
<pre class="eval">mozilla-central
+ browser
de
+ browser
</pre>
<p>and a .mozconfig would look like</p>
<pre>mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../fx-de
ac_add_options --with-l10n-base=..
ac_add_options --disable-compile-environment
ac_add_options --enable-application=browser</pre>
<h4>Firefox via comm-central</h4>
<p>If you followed the steps above to get comm-central, your directory layout would look like</p>
<pre>comm-central
+ mozilla
  + browser
de
+ browser
</pre>
<p>and a .mozconfig would look like</p>
<pre>mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../../fx-de
ac_add_options --with-l10n-base=..
ac_add_options --disable-compile-environment
ac_add_options --enable-application=browser</pre>
<p>{{ Note("The <code>make -f client.mk configure</code> command must be run from the comm-central/mozilla directory.") }}</p>
<p>The <code>--with-l10n-base</code> line is correct with just "<code>..</code>". This is due to the way the environment works within comm-central.</p>
<h4>Thunderbird and SeaMonkey</h4>
<p>If you followed the steps above to get comm-central, your directory layout would look like</p>
<pre>comm-central
+ mail
+ suite
de
+ mail
+ suite
</pre>
<p>and a .mozconfig for Thunderbird would look like</p>
<pre>mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/../tb-de
ac_add_options --with-l10n-base=..
ac_add_options --disable-compile-environment
ac_add_options --enable-application=mail</pre>
<p>Replace <code>tb-de</code> with <code>sm-de</code> and <code>mail</code> with <code>suite</code> for a SeaMonkey .mozconfig.</p>
<p>Run the <code>make -f client.mk configure</code> command from the comm-central directory.</p>
<h3 name="Compare-locales">Compare-locales</h3>
<p><a href="/en/Compare-locales" title="en/Compare-locales">Compare-locales</a> works like it did, for Firefox:</p>
<pre class="eval">compare-locales mozilla-central/browser/locales/l10n.ini . de
</pre>
<p>or for Thunderbird:</p>
<pre>compare-locales comm-central/mail/locales/l10n.ini . de</pre>
<p>Replace mail with suite if you want to check SeaMonkey.</p>
<p>{{ Note("This command may not work correctly for Thunderbird and SeaMonkey, this is in the process of being fixed") }}</p>
<h3 name="Building_langpacks_etc">Building langpacks etc</h3>
<p>There's a small change here, you have to add <code>--with-l10n-base</code> as a configure argument, pointing to the base dir of your l10n repo. Follow <a href="/en/Creating_a_Language_Pack" title="en/Creating_a_Language_Pack">Creating a Language Pack</a>, adjust the paths as needed.</p>
<p>{{ languages( { "es": "es/L10n_en_Mercurial", "fr": "fr/Localisation_avec_Mercurial" } ) }}</p>
Revert to this revision