wok view mercurial/stuff/hgwebdir.cgi @ rev 11926

cleaning up desktop files
author Samuel Trassare <samuel_trassare@yahoo.com>
date Wed Feb 29 15:37:36 2012 -0800 (2012-02-29)
parents
children
line source
1 #!/usr/bin/env python
2 #
3 # An example CGI script to export multiple hgweb repos, edit as necessary
5 # adjust python path if not a system-wide install:
6 #import sys
7 #sys.path.insert(0, "/path/to/python/lib")
9 # enable importing on demand to reduce startup time
10 from mercurial import demandimport; demandimport.enable()
12 # send python tracebacks to the browser if an error occurs:
13 import cgitb
14 cgitb.enable()
16 # If you'd like to serve pages with UTF-8 instead of your default
17 # locale charset, you can do so by uncommenting the following lines.
18 # Note that this will cause your .hgrc files to be interpreted in
19 # UTF-8 and all your repo files to be displayed using UTF-8.
20 #
21 #import os
22 #os.environ["HGENCODING"] = "UTF-8"
24 from mercurial.hgweb.hgwebdir_mod import hgwebdir
25 from mercurial.hgweb.request import wsgiapplication
26 import mercurial.hgweb.wsgicgi as wsgicgi
28 # The config file looks like this. You can have paths to individual
29 # repos, collections of repos in a directory tree, or both.
30 #
31 # [paths]
32 # virtual/path = /real/path
33 # virtual/path = /real/path
34 #
35 # [collections]
36 # /prefix/to/strip/off = /root/of/tree/full/of/repos
37 #
38 # collections example: say directory tree /foo contains repos /foo/bar,
39 # /foo/quux/baz. Give this config section:
40 # [collections]
41 # /foo = /foo
42 # Then repos will list as bar and quux/baz.
43 #
44 # Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
45 # or use a dictionary with entries like 'virtual/path': '/real/path'
47 def make_web_app():
48 return hgwebdir("/etc/mercurial/hgweb.config")
50 wsgicgi.launch(wsgiapplication(make_web_app))