Archive for the ‘Linux’ Category

Mercurial (On Linux) for Mozilla Localization

Friday, September 12th, 2008

Mozilla localizers have been using CVS since many years for contributing on Mozilla (Firefox/Thunderbird) localizations. Recently, Mozilla changed the VCS (Version Control System) from CVS to Mercurial (Hg). I never worked on Hg anytime before, had some confusions setting up the username for submitting my patches to Hg system. After spending some hours, figured out some easy steps to configure username. I have tried to put the basic and simple steps required for the Mozilla Localizers to get their work started on Hg VCS…

  • Installation
    Fedora, OpenSuse

    yum install mercurial

    Debian

    apt-get install mercurial

    Gentoo

    emerge mercurial

  • Configuration
    ~/.ssh/config

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

    (your-local-hg-root)/.hg/hgrc

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

    Setting up a username
    Various ways to setup username, which can be used to display as an author for submitting…

    1. If you specify a -u option to the “hg commit” command on the command line, followed by a username, this is always given the highest precedence.

      hg commit -m “commit message” -u “Firstname Lastname <email@domain>”

    2. If you have set the HGUSER environment variable, this is checked next.

      export HGUSER=”Firstname Lastname <email@domain>”

    3. If you create a file in your home directory called .hgrc, with a username entry, that will be used next. The contents of this file should look like, as shown below:

      # This is a Mercurial configuration file.
      [ui]
      username = Firstname Lastname <email@domain>

      As this configuration is going to be common across various Mercurial repositories on your machine, you can make Mozilla specific settings of the username in the (your-local-hg-root)/.hg/hgrc file by adding the contents exactly in the same format as shown above.

    4. If you have set the EMAIL environment variable, this will be used next.

      export EMAIL=”<email@domain>”

    5. Mercurial will query your system to find out your local user name and host name, and construct a username from these components. Since this often results in a username that is not very useful, it will print a warning if it has to do this.

    The name and e-mail Id configured will be displayed as author on the actual Hg repository: http://hg.mozilla.org/l10n-central/ . It doesn’t matter which e-mail ID is used as an account to access the Mozilla repository.

  • Download L10n

    hg clone http://hg.mozilla.org/l10n-central/ab-CD/

  • Submit L10n

    hg commit -m “message identifying the change (bug 555)”
    hg push

  • References:
    http://developer.mozilla.org/En/L10n_on_Mercurial
    http://hgbook.red-bean.com/