Hgweb Mercurial template customization
Customizing the style of a HG / mercurial web repository
If you use the hgwebdir.cgi
system to provide a web view
of your mercurial repository, to customize the style like I did for http://hg.colas.nahaboo.net, a
way to do it is (in debian, paths to adapt to your linux
distribution):
- copy
/usr/share/mercurial/templates/gitweb
somewhere among your hg repositories. make a hg repository out of it - clone it to another one, e.g.
myhg
. This way, when upgrades will change the distributed templates, you will just have to copy the new ones in yourgitweb
repo, commit, and pull+merge the changes into yourmyhg
repo. - edit the files in it: header.tmpl to add css code, etc. Adding links in the page headers will make you edit most of the files
- install by copying it to
/usr/share/mercurial/templates/myhg
- edit your /etc/mercurial/hgrc to tell hgwebdir.cgi to use your new
templates by a line
style=myhg
. in your[web]
section. Here is my file as an exemple:
# system-wide mercurial configuration file
# See hgrc(5) for more information
[trusted]
users=colas
[web]
baseurl=http://hg.colas.nahaboo.net/
contact=colas@nahaboo.net
description=Open source software made by Colas Nahaboo
maxchanges=16
staticurl=http://hg.colas.nahaboo.net/static/
style=colas
- The above will make these settings global to the site. but you can
still override them on a per-repository basis by adding these lines into
the
hgweb.config
of the repositories. - Note that you can use HTML code in the description field
- This
hgrc
is not cloned byhg
. So you must add/edit it directly on the web repository, you cannot prepare it in advance in your work dir and expect it to be pushed on the web site on first creation
-- ColasNahaboo - 2008-04-06