Tuesday, December 23, 2008

setup a couple of l10n-central's repos locally *with* pushlog

This is the milestone that I wanted to reach after the last couple of blog posts.
I wanted to have a local hg server with few of the l10n repositories and with pushlog to be able to test an HgPoller. Let's see if this is the last one of this series of posts.

What I did on the server side:

  1. cd /var/hg/l10n-central
  2. hg clone http://hg.mozilla.org/l10n-central/af
  3. hg clone http://hg.mozilla.org/l10n-central/de
  4. replaced the .hg/hgrc of both repos with what was explained on my first post plus adding the push_ssl and allow_push values:
    # 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

    push_ssl = false
    allow_push = *
    templates = /repos/hg_templates
    style = gitweb_mozilla
    pushlog-feed = /repos/hgpoller/pushlog-feed.py
    buglink = /repos/hgpoller/buglink.py
    hgwebjson = /repos/hgpoller/hgwebjson.py
  5. /var/hg$ hg serve --webdir-conf hgweb.config

NOTE: Remember to export PYTHONPATH=/repos/hghooks/ - You would get an error like this when trying to push if not set: "abort: pretxnchangegroup.a_singlehead hook is invalid (import of "mozhghooks.single_head_per_branch" failed)". In fact, I have put it on my .bashrc

NOTE2: It is not suggested to use "allow_push = *" and "push_ssl = false" since you allow everyone who can reach your server to commit changes

What I did on the client side:

  1. hg clone http://localhost:8000/af
  2. make some changes on the checked out repo
  3. add "default-push = http://localhost:8000/af" under [paths] in my checked out repo's .hg/hgrc file
  4. hg commit -m "message"
  5. hg push

To check the web interface and/or the pushlog of that repo browse to:
  • http://localhost:8000/af
  • http://localhost:8000/af/pushlog

My wish list:

I would like to be able to have the URL to look like:
  • http://localhost:8000/l10n-central/af
so I could have things like:
  • http://localhost:8000/releases/l10n-mozilla-1.9.1/af
but for now I believe that I am in good shape and that this improvement might actually require me to setup an apache server which I am trying to avoid.


  1. You'll need the subdirs, as those denote the branches in the hgpoller.

    Looking at the doc you referenced in your previous post, did you try out

    style = gitweb


    You should have a mozilla-central clone next to your l10n-central dir, too, our setups don't support having code on different hg servers.

  2. Actually, gitweb_mozilla should probably be ok.

    Maybe put the web config back into a separate file and run hg serve from the parent of the hg repo dirs?

  3. This is what I have which is not mentioned on the blog post:

    $> cat /var/hg/hgweb.config
    l10n-central/ = l10n-central/
    mozilla-central/ = mozilla-central/
    style = gitweb_mozilla
    ^^ not sure if this last [web] section applies

    $> ls /var/hg/l10n-central/
    af de test

    $> ls /var/hg/mozilla-central/
    ^^ maybe I should have mozilla-central one level above and remove the collections's item for mozilla-central