author | Brendan Cully <brendan@kublai.com> |
Fri, 22 Sep 2006 08:19:25 -0700 | |
changeset 3144 | 8342ad5abe0b |
parent 2506 | d0db3462d568 |
child 3781 | 713e35dcc321 |
permissions | -rw-r--r-- |
941 | 1 |
#!/usr/bin/env python |
2 |
# |
|
3 |
# An example CGI script to export multiple hgweb repos, edit as necessary |
|
4 |
||
1064
8d791bea49d4
Removed obsolete imports from hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents:
941
diff
changeset
|
5 |
import cgitb, sys |
941 | 6 |
cgitb.enable() |
7 |
||
8 |
# sys.path.insert(0, "/path/to/python/lib") # if not a system-wide install |
|
2506
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
9 |
from mercurial.hgweb.hgwebdir_mod import hgwebdir |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
10 |
from mercurial.hgweb.request import wsgiapplication |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
11 |
import mercurial.hgweb.wsgicgi as wsgicgi |
941 | 12 |
|
1829
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
13 |
# The config file looks like this. You can have paths to individual |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
14 |
# repos, collections of repos in a directory tree, or both. |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
15 |
# |
941 | 16 |
# [paths] |
17 |
# virtual/path = /real/path |
|
18 |
# virtual/path = /real/path |
|
1829
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
19 |
# |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
20 |
# [collections] |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
21 |
# /prefix/to/strip/off = /root/of/tree/full/of/repos |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
22 |
# |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
23 |
# collections example: say directory tree /foo contains repos /foo/bar, |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
24 |
# /foo/quux/baz. Give this config section: |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
25 |
# [collections] |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
26 |
# /foo = /foo |
b0f6af327fd4
hgwebdir: export collections of repos
Vadim Gelfer <vadim.gelfer@gmail.com>
parents:
1144
diff
changeset
|
27 |
# Then repos will list as bar and quux/baz. |
941 | 28 |
|
1144
8a39df05d2c1
Documented passing list or dict instead of config file in hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1064
diff
changeset
|
29 |
# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples |
8a39df05d2c1
Documented passing list or dict instead of config file in hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1064
diff
changeset
|
30 |
# or use a dictionary with entries like 'virtual/path': '/real/path' |
8a39df05d2c1
Documented passing list or dict instead of config file in hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1064
diff
changeset
|
31 |
|
2506
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
32 |
def make_web_app(): |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
33 |
return hgwebdir("hgweb.config") |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
34 |
|
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
35 |
wsgicgi.launch(wsgiapplication(make_web_app)) |