Localizing with Mercurial

  • Revision slug: Localizing_with_Mercurial
  • Revision title: Localizing with Mercurial
  • Revision id: 18499
  • Created:
  • Creator: Standard8
  • Is current revision? No
  • Comment 4 words added, 27 words removed

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.

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.

{{template.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. After finishing a change or set of changes 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

If you followed the steps above, your directory layout would look like

mozilla-central
+ browser
de
+ browser

and a .mozconfig would look like (UNTESTED YET)

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

Compare-locales

Compare-locales works like it did,

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

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>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><span class="lang lang-en"><cite id="{{'endnote_' .. $0}}">{{template.Note(</cite></span>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. After finishing a change or set of changes 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>
<p>If you followed the steps above, your directory layout would look like</p>
<pre class="eval">mozilla-central
+ browser
de
+ browser
</pre>
<p>and a .mozconfig would look like (UNTESTED YET)</p>
<pre class="eval">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>
<h3 name="Compare-locales">Compare-locales</h3>
<p><a href="/en/Compare-locales" title="en/Compare-locales">Compare-locales</a> works like it did,</p>
<pre class="eval">compare-locales mozilla-central/browser/locales/l10n.ini . de
</pre>
<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