Playing with Mercurial styles

As a sort of “Hello World” type of exercise jorendorff recommended that I play around with the styles in hgweb. I had 2 goals to achieve

  1. My mission is to get the gitweb_mozilla style working on my computer
  2. Then edit the templates to make the whole page orange

I downloaded a repository provided by bsmeberg called hgpoller. This would be my development playground. Now, I thought that my next step would be to make changes to hgpoller.hghgrc to change the style. I tried that by adding


This didn’t work as planned. The style reverted to the default. What I didn’t realize is that Mercurial gets its style specifications from the Mercurial.ini file (in Windows). The style must be adjusted from there. When I added style=gitweb_mozilla to that file the change worked and I got the appropriate result. To make Mercurial take its style information from the hgpoller.hghgrc file I added the following line with some help from jorendorff


Now, I can easily make changes to the hgrc file which will be reflected on hgpoller. You may be wondering how do I see the repo in a browser? To do that one needs to use the hg serve command which will start a hgweb server on port 8000 on your machine. Then one can just visit http://localhost:8000/

My objective was to get the gitweb_mozilla style working on my machine but I couldn’t find that style listed in my templates directory. The reason being that I needed to clone that style from (thanks for pointing that out djc).

After getting the style operating the next step involved getting the bugzilla links working. The key to that is the file. It has to be enabled by entering the following in hgpoller.hghgrc


After doing all that I was finally able to achieve my first goal which gave me this result

The next step was to alter the style, in this case change the whole page to orange. To do this one has to alter the <your-template-folde>staticstyles-gitweb.css file. I added the background-color attribute to the body area and set it to orange like so…

body { font-family: sans-serif; font-size: 12px; margin:0px; border:solid #d9d8d1; border-width:1px; margin:10px; background-color:Orange; }

which gave this result

Mission Accomplished!

This entry was posted in Mercurial Project, Open Source and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>