author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
Sun, 10 Dec 2006 16:24:21 +0100 | |
changeset 3858 | 7c12958eba26 |
parent 3781 | 713e35dcc321 |
child 3868 | 6033d9f28052 |
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 |
|
3781
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
32 |
# If you'd like to serve pages with UTF-8 instead of your default |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
33 |
# locale charset, you can do so by uncommenting the following lines. |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
34 |
# Note that this will cause your .hgrc files to be interpreted in |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
35 |
# UTF-8 and all your repo files to be displayed using UTF-8. |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
36 |
# |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
37 |
# os.environ["HGENCODING"] = "UTF-8" |
713e35dcc321
hgweb: report detected character set
Matt Mackall <mpm@selenic.com>
parents:
2506
diff
changeset
|
38 |
|
2506
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
39 |
def make_web_app(): |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
40 |
return hgwebdir("hgweb.config") |
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
41 |
|
d0db3462d568
This patch make several WSGI related alterations.
Eric Hopper <hopper@omnifarious.org>
parents:
1829
diff
changeset
|
42 |
wsgicgi.launch(wsgiapplication(make_web_app)) |