hgwebdir.cgi
author Matt Mackall <mpm@selenic.com>
Mon, 24 Jul 2006 17:06:39 -0500
changeset 2658 2be3001847cb
parent 2506 d0db3462d568
child 3781 713e35dcc321
permissions -rw-r--r--
Merge with crew
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     1
#!/usr/bin/env python
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     2
#
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     3
# An example CGI script to export multiple hgweb repos, edit as necessary
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     4
1064
8d791bea49d4 Removed obsolete imports from hgwebdir.cgi
Thomas Arendsen Hein <thomas@intevation.de>
parents: 941
diff changeset
     5
import cgitb, sys
941
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     6
cgitb.enable()
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     7
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
     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
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
    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
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
    16
# [paths]
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
    17
# virtual/path = /real/path
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
    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
4cf418c2a013 Add a multi-repository server
mpm@selenic.com
parents:
diff changeset
    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))