changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > werc / bin/contrib/hgwebdir.cgi

changeset 672: cd59fedffc2e
parent: c4b07f81f234
author: sl
date: Fri, 02 Dec 2016 20:35:58 -0500
permissions: -rwxr-xr-x
description: etc/initrc: change default markdown formatter from markdown.pl (no modern perl on plan 9) to md2html.awk (works everywhere)
1 #!/usr/bin/env python
2 #
3 # An example CGI script to export multiple hgweb repos, edit as necessary
4 
5 # send python tracebacks to the browser if an error occurs:
6 import cgitb
7 cgitb.enable()
8 
9 # adjust python path if not a system-wide install:
10 #import sys
11 #sys.path.insert(0, "/path/to/python/lib")
12 
13 # If you'd like to serve pages with UTF-8 instead of your default
14 # locale charset, you can do so by uncommenting the following lines.
15 # Note that this will cause your .hgrc files to be interpreted in
16 # UTF-8 and all your repo files to be displayed using UTF-8.
17 #
18 #import os
19 #os.environ["HGENCODING"] = "UTF-8"
20 
21 from mercurial.hgweb.hgwebdir_mod import hgwebdir
22 from mercurial.hgweb.request import wsgiapplication
23 import mercurial.hgweb.wsgicgi as wsgicgi
24 
25 # The config file looks like this. You can have paths to individual
26 # repos, collections of repos in a directory tree, or both.
27 #
28 # [paths]
29 # virtual/path = /real/path
30 # virtual/path = /real/path
31 #
32 # [collections]
33 # /prefix/to/strip/off = /root/of/tree/full/of/repos
34 #
35 # collections example: say directory tree /foo contains repos /foo/bar,
36 # /foo/quux/baz. Give this config section:
37 # [collections]
38 # /foo = /foo
39 # Then repos will list as bar and quux/baz.
40 #
41 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
42 # or use a dictionary with entries like 'virtual/path': '/real/path'
43 
44 def make_web_app():
45  return hgwebdir("hgweb.config")
46 
47 wsgicgi.launch(wsgiapplication(make_web_app))