Thursday, December 18, 2008

Setup your own hg local repo with pushlog

I am working on generating repackages on change and the HgLocalePoller looks for the pushlog of a locale's repository. For instance:

Since my development and testing is dependent on commit changes to the l10n repositories, I need to have commit access to generate more changes and since I am not a localizer I do not have access to the l10n repositories.

Therefore there were three options for me:
  1. Gain commit access to the x-testing repository on the l10n repositories and do commits in there. Inconvenience: It is a long process to gain access.
  2. Create my own user repo in The same inconvenience as the previous one
  3. Setup my own local repo with pushlog
I was lucky enough that ted was around and he proposed me and guided me to do this last option.

Steps to create your own hg repo locally with pushlog:

  1. cd /repos
  2. hg clone
  3. hg clone
  4. hg clone
  5. mkdir test-repo
  6. cd test-repo
  7. hg init
  8. cp ../hghooks/examples-hgrc .hg/hgrc // which basically contains the following:
    # the a_ and z_ prefixes are for ordering:
    # any hooks which can veto an action (require-singlehead) should be run before
    # hooks which make permanent logs (record-changeset-info)

    pretxnchangegroup.a_singlehead = python:mozhghooks.single_head_per_branch.hook
    pretxnchangegroup.z_linearhistory = python:mozhghooks.pushlog.log

  9. export PYTHONPATH=/repos/hghooks/ // /repos is my path, use your own
  10. vi .hg/hgrc // Add the following with your own paths:
    templates = /repos/hg_templates
    style = gitweb_mozilla
    pushlog-feed = /repos/hgpoller/
    buglink = /repos/hgpoller/
    hgwebjson = /repos/hgpoller/
  11. sudo apt-get install python-simplejson //hgwebjson needs this module
  12. hg serve //To start your hg server

You can now check your own hg server with pushlog:
and your pushlog at:

Remember that it is a server and you have to clone first!

  1. export PYTHONPATH=/repos/hghooks/
  2. hg clone test-repo test-repo-2
  3. cd test-repo-2; echo "test data" > testfile;
  4. hg add testfile;
  5. hg ci -m "adding a test file";
  6. hg push ../test-repo


  1. The HG templates repo is located here:

  2. Note that Mercurial 1.2 does not work with our hooks. Bug to follow it.

    You can do easy_install mercurial=1.1 to get the right version

  3. Armen, remember to check this post:
    where the config files is correct:
    templates = /repos/hg_templates
    style = gitweb_mozilla
    l10n-central/af = l10n-central/af
    l10n-central/de = l10n-central/de
    mozilla-central = mozilla-central