Admin/Mercurial/hgwebdir.cgi
author haftmann
Sun Dec 15 15:10:16 2013 +0100 (2013-12-15)
changeset 54745 46e441e61ff5
parent 40385 b70ef70733e8
permissions -rwxr-xr-x
disambiguation of interpretation prefixes
wenzelm@27725
     1
#!/usr/bin/env python
wenzelm@27725
     2
#
wenzelm@27725
     3
# An example CGI script to export multiple hgweb repos, edit as necessary
wenzelm@27725
     4
wenzelm@27725
     5
# adjust python path if not a system-wide install:
wenzelm@27725
     6
import sys
wenzelm@40385
     7
# using the hg installation provided by the system (AK, 3.3.2010)
wenzelm@40385
     8
#sys.path.insert(0, "/home/isabelle-repository/repos/mercurial-www4/lib64/python2.5/site-packages")
wenzelm@40385
     9
#sys.path.insert(0, "/usr/lib64/python2.5/site-packages")
wenzelm@40385
    10
#sys.path.insert(0, "/home/isabelle-repository/repos/mercurial-1.3.1/lib64")
wenzelm@40385
    11
#sys.path.insert(0, "/home/isabelle-repository/repos/testtool")
wenzelm@40385
    12
wenzelm@27725
    13
wenzelm@27725
    14
# enable importing on demand to reduce startup time
wenzelm@27725
    15
from mercurial import demandimport; demandimport.enable()
wenzelm@27725
    16
wenzelm@27725
    17
# Uncomment to send python tracebacks to the browser if an error occurs:
wenzelm@27725
    18
import cgitb
wenzelm@27725
    19
cgitb.enable()
wenzelm@27725
    20
wenzelm@27725
    21
# If you'd like to serve pages with UTF-8 instead of your default
wenzelm@27725
    22
# locale charset, you can do so by uncommenting the following lines.
wenzelm@27725
    23
# Note that this will cause your .hgrc files to be interpreted in
wenzelm@27725
    24
# UTF-8 and all your repo files to be displayed using UTF-8.
wenzelm@27725
    25
#
wenzelm@27725
    26
import os
wenzelm@27725
    27
os.environ["HGENCODING"] = "UTF-8"
wenzelm@40385
    28
os.environ["HGRCPATH"] = "/home/isabelle-repository/repos/hgrc"
wenzelm@27725
    29
wenzelm@27725
    30
from mercurial.hgweb.hgwebdir_mod import hgwebdir
wenzelm@27725
    31
import mercurial.hgweb.wsgicgi as wsgicgi
wenzelm@27725
    32
wenzelm@27725
    33
# The config file looks like this.  You can have paths to individual
wenzelm@27725
    34
# repos, collections of repos in a directory tree, or both.
wenzelm@27725
    35
#
wenzelm@27725
    36
# [paths]
wenzelm@27725
    37
# virtual/path = /real/path
wenzelm@27725
    38
# virtual/path = /real/path
wenzelm@27725
    39
#
wenzelm@27725
    40
# [collections]
wenzelm@27725
    41
# /prefix/to/strip/off = /root/of/tree/full/of/repos
wenzelm@27725
    42
#
wenzelm@27725
    43
# collections example: say directory tree /foo contains repos /foo/bar,
wenzelm@27725
    44
# /foo/quux/baz.  Give this config section:
wenzelm@27725
    45
#   [collections]
wenzelm@27725
    46
#   /foo = /foo
wenzelm@27725
    47
# Then repos will list as bar and quux/baz.
wenzelm@27725
    48
#
wenzelm@27725
    49
# Alternatively you can pass a list of ('virtual/path', '/real/path') tuples
wenzelm@27725
    50
# or use a dictionary with entries like 'virtual/path': '/real/path'
wenzelm@27725
    51
wenzelm@28000
    52
application = hgwebdir('/home/isabelle-repository/repos/hgweb.config')
wenzelm@27725
    53
wsgicgi.launch(application)